• Resolved Graicifyd

    (@graicifyd)


    I have a radio button field (fieldname1) with three options: a, b and c. I have a calculated field – fieldname2, how can I automatically tick the radio button?

    for instance, if fieldname2 (a calculated field) = 2, option a should be selected in fieldname1,

    if fieldname2 = 3, option b should be selected in fieldname1

    Thank you for your support.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello,

    If the radio button field is the fieldname1 and you want tick the choice with value: “a”, use the following piece of code as part of the equation:

    
    getField(1).setVal('a');
    

    The parameter in the getField operation would be the numeric part of the field’s name.

    Best regards.

    Thread Starter Graicifyd

    (@graicifyd)

    Thank you.

    I have implemented it this way:

    (function(){
    
    if(fieldname114<=5.5 )return getField(127).setVal('0');
    
    if(fieldname114>5.5&&fieldname115<=9.4 return getField(127).setVal('1');
    
    if(fieldname114>9.4&&fieldname115<=10) return getField(127).setVal('2');
    
    if(fieldname114>10&&fieldname115<=12) return  getField(127).setVal('3');
    
    if(fieldname114>12&&fieldname115<=14) return  getField(127).setVal('4');
    
    if(fieldname114>14&&fieldname115<=16) return  getField(127).setVal('5');
    
    if(fieldname114>16&&fieldname115<=20) return  getField(127).setVal('6');
    
    })()
    

    I am not sure my implementation is correct because the options are not getting checked automatically.

    This is the page I am working on.

    Plugin Author codepeople

    (@codepeople)

    Hello @graicifyd

    You have forgotten the close parenthesis into the piece of code:

    
    if(fieldname114>5.5&&fieldname115<=9.4 return getField(127).setVal('1');
    

    as follows:

    
    if(fieldname114>5.5&&fieldname115<=9.4) return getField(127).setVal('1');
    

    Best regards.

    Thanks for this I have just used this on two dropdowns and it worked perfectly!!

    I love this plugin!!!!!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Auto select radio button option’ is closed to new replies.