How do I create an HTML form with simple calculation for BMI?

Hi all, I am trying to design an HTML form that involves calculation. for example calculating output from several sources such as urine output+drain output etc. I thought about using a simple JAVA code for this (I am not a programmer by the way) but I found a problem. It does not seem that the calculation will work. I copied and pasted Vitals form into a new form and I noticed that the BMI is not being calculated anymore. If any can help me to do the right thing I would really appreciate it. All I am trying to do is simple SUM and Minus for numerical concepts

Thanks

2 Likes

Hi, I’m also working on a BMI functionality.
Did you got a solution for this?

If what you want is to do some calculations from different input fields in the form, you can achieve that by adding some simple JavaScript.

Check this page for reference.

…sample code:

    <obs id="a" .../>
    <obs id="b" .../>

    <span id="calculated-value"></span>

    <script>
    function calculateAandB() {
        var displayVal = getValue("a.value") + getValue("b.value");
        $j('#calculated-value').html(displayVal);
    }

    getField("a.value").change(calculateAandB);
    getField("b.value").change(calculateAandB);
    </script>
1 Like