Avatar

Correct answer by
Level 5

Not sure if I understand the layout so correct me if Im wrong. I am presuming you have a radio button group on the top line for the first 3 check boxes (where the user selects one) and check boxes for the 2 subsequent lines (where the user can select independantly of the other 3 above) with a final calculation at the end in check amount field.

You can either place code on each change event of each checkbox/radio button to recalculate or just have it on the final check amount field. I tried placing a calculate on the final Check Amount field and it seems to do what is required.

Try this in the calculate event of the Check Amount field

var membershipAmount = 0;

if ( (RadioButtonList.rawValue == "2") || (RadioButtonList.rawValue == "3") )

{

    membershipAmount = 35;

}

if (CheckBox1.rawValue == "1" )

{

    membershipAmount += 15;

}

if (CheckBox2.rawValue == "1" )

{

    var txtAmount = TextField3.rawValue;

    var amt = 0;

    if ( (txtAmount != null ) && (! isNaN(txtAmount) ) )

    {

        amt = parseFloat(txtAmount);

    }

   

    membershipAmount += amt;

}

this.rawValue = membershipAmount;

View solution in original post