Expand my Community achievements bar.

Radio Buttons and hiding subforms

Avatar

Former Community Member

Hello,

I have a set of 3 radio buttons. The user must choose one of the three options. The problem I am having is that the user will choose one option and a hidden form will appear. then if they change their mind and decide to choose another option then the first form should hide and the new form should appear. The forms are all staying visible instead of hiding. How do I fix this? Here is the script I am using for each of the radio buttons. Any suggestions that can be made would be greatly appreciated.


NikDk

if

(this.rawValue == 1)

{divorce.presence

= "visible";}

else

{divorce.presence

= "hidden";

MailingAdd_6.presence

= "hidden";

exMailingAdd.presence

= "hidden";

exSkMailAdd.presence

= "hidden";

genericAdd.presence

= "hidden";}

 

form.deleteDependant.RadioButtonList.divorceck::click - (JavaScript, client)

if

(divorceck.rawValue == "1")

{divorce.presence

= "visible";

divorce.divorceday.mandatory

= "error";

divorce.divorcemonth.mandatory

= "error";

divorce.divorceyear.mandatory

= "error";

}

else

if

(divorceck.rawValue == "0")

{divorce.presence

= "hidden";

MailingAdd_6.presence

= "hidden";

exMailingAdd.presence

= "hidden";

exSkMailAdd.presence

= "hidden";

genericAdd.presence

= "hidden";

divorce.divorceday.mandatory

= "disabled";

divorce.divorceday.rawValue

="";

divorce.divorcemonth.mandatory

= "disabled";

divorce.divorcemonth.rawValue

="";}

2 Replies

Avatar

Level 10

Hi NikDk,

It looks like you have the script in each of the radio buttons. It will be much simpler if you change this so that you only have script in the click event of the radio button exclusion group (RadioButtonList).

First make sure that each of the radio buttons has a specified value in the Object > Binding palette. Typically 1, 2, 3.

If you select the exclusion group in the hierarchy, in the script editor you can place script something like this:

if (this.rawValue == 1)

{

     // script here for what you want hidden/visible

     // if the first button is clicked

}

else if (this.rawValue == 2)

{

     // script here for what you want hidden/visible

     // if the second button is clicked

}

else

{

     // script here for what you want hidden/visible

     // if the third button is clicked

}

You will need to delete the script in the individual buttons.

Hope that helps,

Niall

Assure Dynamics

Avatar

Former Community Member

Hello and thank you for your help. I out why it wasn't working. Thanks for

all of your help!