Expand my Community achievements bar.

Radio Buttons / Subform Visibility

Avatar

Level 3

I have three radio buttons in a group, controlling the visibility of three subforms.

I am using the below code to do this..

if

(FixedArrangement.rawValue == 1){

Sub1.presence

= "visible";

}

else {

Sub1.presence

= "invisible";

}

All subforms are invisible by default, and when a user checks a radio button the subform becomes visible.

How do I make it, so that if a user checks the next radio button in the group, the first subform that was displayed turns invisible, and it displays the second subform?

I hope I have made myself clear?

At present the user clicks the first radio button, the first subform is displayed, but if he then clicks the second radio button in the list, the second subform is displayed, but the first subform is still also visible.

Thanks

4 Replies

Avatar

Former Community Member

How about something like this....

// form1.page1.option.displayChoice::change - (JavaScript, client)

switch (this.rawValue) {

case "1":

   form1.page1.subform1.presence = "visible";

   form1.page1.subform2.presence = "hidden";

   form1.page1.subform3.presence = "hidden";

   break;

case "2":

   form1.page1.subform1.presence = "hidden";

   form1.page1.subform2.presence = "visible";

   form1.page1.subform3.presence = "hidden";

   break;

case "3":

   form1.page1.subform1.presence = "hidden";

   form1.page1.subform2.presence = "hidden";

   form1.page1.subform3.presence = "visible";

   break;

default:

   break;

}

Steve

Avatar

Level 2

Is there a way to use this radio button visibility script, but also make certain text fields mandatory when each subform becomes visible? And then when it goes hidden again, the mandatory field is disabled?

If so, how would I do this. I've read a little bit about how to do this if there are only two conditions (i.e. if one field is visible, then the other is not). However, radio buttons consist of more variables, so I'm trying to figure out where the scripting would go.

Thanks.

-ET

Avatar

Level 10

Just to jump in...

There is an example here: http://assure.ly/hxHupW.

Basically there are two properties that you want to change the "presence" property and the "mandatory" property.

For example:

Textfield.mandatory = "error";

Textfield.presence = "visible";

and

Textfield.mandatory = "disabled";

Textfield.presence = "hidden";

A similar example looks at the presence property: http://assure.ly/h7whb8.

Hope that helps,

Niall

Avatar

Level 2

Niall,

You're the man, that helps a lot.

Do you know how to turn off mandatory notifications when you do this? A window will pop up and say that I have to fill in this field everytime the mandatory field is activated.

Thanks

-ET