Expand my Community achievements bar.

Radio button selection controls visibility of a subform

Avatar

Level 7

Hello,

I have two radio buttons where depending on which button is selected controls which subform is displayed. Its not working. I'd appreciate an extra pair of eyes taking a look at my script to help me see what's wrong. I've gotten this to work before, but this time something's wrong.

Here's the script:

if

(decision.choiceList.rawValue == '1'){

newHire.presence

= "visible";

}

if

(decision.choiceList.rawValue != '1'){

newHire.presence

= "hidden";

}

if

(decision.choiceList.rawValue == '2'){

page2.presence

= "visible";

}

if

(decision.choiceList.rawValue != '2'){

page2.presence

= "hidden";

}

if

(decision.choiceList.rawValue == null){

page2.presence

= "hidden";

}

if

(decision.choiceList.rawValue == null){

newHire.presence

= "hidden";

}

I've checked and rechecked the names of the objects and they appear to be accurate, but still no success.

Thanks,

MDawn

5 Replies

Avatar

Level 10

Hi,

Make sure the form is saved as a Dynamic XML Form in the save-as dialog.

I would use an if/else and try and group conditions. The following is in the client vent of the radio button exclusion group (eg not in the individual buttons):

if (decision.choiceList.rawValue == "1")

{

     newHire.presence = "visible";

     page2.presence = "hidden";

}

else if (decision.choiceList.rawValue == "2")

{

     newHire.presence = "hidden";

     page2.presence = "visible";

}

else

{

     newHire.presence = "hidden";

     page2.presence = "hidden";

}

Also make sure that the radio buttons have specified values, 1 and 2.

Hope that helps,

Niall

Assure Dynamics

Avatar

Level 7

Thanks, Niall. I'll try this. I did remember to save as a Dynamic XML form. I'll try your version of the script.

Thanks,

Margaret Dawn

630-850-1065

Avatar

Level 7

Just to verify, is this JavaScript?

Thanks,

Margaret Dawn

630-850-1065

Avatar

Level 7

Sorry to be so dumb. I was getting desperate. And it turned out to be a dumb mistake. I had set the Form Preferences to Dynamic, but neglected to actually save the doc! When I save the doc correctly it now works.

Margaret Dawn

630-850-1065