Avatar

Level 4

Hello,

I've created  a set of 5 radio buttons. When the user chooses one of the buttons a subform opens. if the user then chooses another button, the previous one should close and the new one should appear. THey are all opening up properly but they will not hide when a new button is chosen. Maybe I'm using the wrong script?

under the change event i'm using the following:

if

(this.rawValue == "1"){

one.presence

= "visible";}

else

{one.presence

= "hidden"

one.rawValue

="";}

if

(this.rawValue == "2"){

two.presence

= "visible"

}

else {

two.presence

= "hidden"

two.rawValue

="";}

Under the click event I'm using this:

if

(NumOfDep.rawValue == "1")

{one.presence

= "visible";

one.surname.mandatory

= "error";

one.firstname.mandatory

= "error";

one.birthday.mandatory

= "error";

one.birthmonth.mandatory

= "error";

one.birthyear.mandatory

= "error";}

else

if

(NumOfDep.rawValue == "0")

{one.presence

= "hidden";

one.surname.mandatory

= "disabled";

one.surname.rawValue

="";

one.firstname.mandatory

= "disabled";

one.firstname.rawValue

="";

one.birthday.mandatory

= "disabled";

one.birthday.rawValue

="";

one.birthmonth.mandatory

= "disabled";

one.birthmonth.rawValue

="";

one.birthyear.mandatory

= "disabled";

one.birthyear.rawValue

="";}

can anyone explain what I'm doing wrong?


Thank you in advance for your help!

Nik