Expand my Community achievements bar.

If/Else Syntax to set Radio Button value not working

Avatar

Former Community Member

My form has several radio buttons, the first set lets them choose options A, B or C.

If they select option "B" in radio button group named rType, we're needing the value of another radio group, rSavClass, to have a value of 1. 

In the below code, it is giving it a value of 1 no matter which choice I select in rType.  What am I doing wrong?

Thank you!

var

myVal = rType.rawValue;

if

(myVal = 2)

{

rSavClass.rawValue

="1";

}

else

{

rSavClass.rawValue

="0";

}

3 Replies

Avatar

Former Community Member

Update - resolved.  I was adding the code to the exit event of the subform containing the radio buttons, but ended up adding the code to each of the three radio buttons on their enter event, modifying it slightly per the results needed per button.  I was trying to handle it as a group, but needed to add to each individual button.  It's working fine now.

Avatar

Former Community Member

Had an additional issue pop up and not sure how to change this question to unanswered.  The radio button value I'm needing to control is also controlled by another field (numeric value) with below code, which works nicely.  The problem is, a Type 'B' selection in the radio button can also have a value greater than 9999 (first 'if' statement below).  How do I modify below code so that regardless of the value they enter into the numeric field, if the other radio button value is '2' (type B), that will override everything and always give rSavClass a value of '1'.  Thank you!

Message was edited by: sparrowce

Avatar

Former Community Member

I apologize, I see I posted in the wrong category, this post should be in ES 8.2, not 'Pre-ES'.  Should I re-post there, or can anyone assist?

Thank you very much.