Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Radio button creates mandatory field

gretchenhs42
Level 3
Level 3

I have a form that has several radio buttons and corresponding Comment boxes.

When the user chooses the No radio button, I want the comments section to become mandatory.

So I wrote

 

if (RadioQ2.rawValue=="2"){

       

Q2.mandatory

 

}

In the binding tab, the No item has a value of 2.

RadioQ2 is the radio buttons and Q2 is the comments for question 2.

This works for No, but also gives the same message for Yes (which = 1).

I am certainly not a programmer by any means, so what I have is probably not correct, but I hope I'm sort of close!

Thanks for your help, Gretchen

1 Accepted Solution
whyisthisme
Correct answer by
Level 7
Level 7

try this:

if (RadioQ2.rawValue=="2"){

Q2.validate.nullTest = "error";

}

else {Q2.validate.nullTest = "disabled";

}

View solution in original post

2 Replies
whyisthisme
Correct answer by
Level 7
Level 7

try this:

if (RadioQ2.rawValue=="2"){

Q2.validate.nullTest = "error";

}

else {Q2.validate.nullTest = "disabled";

}

View solution in original post

gretchenhs42
Level 3
Level 3

Thank you very much for your help!

Sorry it took me a few days to respnd, I've been out with bronchitis.