Expand my Community achievements bar.

Radio button validation

Avatar

Level 2

Hi

I am looking to put validation on a radio button that makes the user complete a checkbox, numeric field etc if the user says yes.

1 Reply

Avatar

Level 10

Hi,

You can make fields mandatory or optional with JavaScript code like this in the change event of the radiobuttonlist (the container of your Yes/No radio buttons).  By default the first radio button will have a value of 1.

if (this.rawValue == 1)

{

    CheckBox1.validate.nullTest = "error";

    NumericField1.validate.nullTest = "error";

}

else

{

    CheckBox1.validate.nullTest = "disabled";

    NumericField1.validate.nullTest = "disabled";

}