• Resolved malpica

    (@malpica)


    Hi,

    I have two radio buttons DS fiels (database source). One is fieldname4 and the other is fieldname5. Both of them have class .special-radio.

    I need to know what the value of the last selected input of the two groups is and that this vaule . For example:
    My client press a radio button of fieldname4, then in one calculate field I make operatios with this value. But if my client press in the other radio buttons Ds field (fieldname5), this new value must be recognized by the calculate field and recalculate.

    I have this function:
    (function(){
    var values = [fieldname4,fieldname5],
    total = 0,
    counter = 0;
    for(var i in values)
    {
    if(values[i]) counter++;
    total += values[i];
    }
    var result = PREC((counter)?total/counter:0, 0);
    return result;
    })()

    The problem is that if my client press three o four times other radio buttons, the forms stop working.

    Best regards

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @malpica,

    This piece of code:

    var result = PREC((counter)?total/counter:0, 0);

    should be implemented as follows:

    var result = ROUND((counter)?total/counter:0);

    Could you send me the link to the webpage where the form is inserted to check the issue in detail, please?

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘last value of two groups of radio buttons’ is closed to new replies.