Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

RadioButtonList - Riddle - URGENT

Avatar

Level 2
Dear Community,



I have a riddle I am unable to solve:

I have a RadiobuttonList with eight items the bindings tab has them connected to the rawValues 1-8. Also on my form there is a form connected to a checkbox with the rawValue 0 and 1



If the RadioButtonList has a rawValue == 8

3 other subforms have to dissapear no matter what the checkbox says.



If the RadioButtonList has a rawValue != 8 and the checkbox is checked

three subforms have to appear.



If the RadioButtonList has a rawValue != 8 and the checkbox isn't checked

two subforms have to appear and one subform has to dissapear:



The folowing script has first been placed in the "click" event of the "RadioButtonList" (not of each RadioButton) and afterwards in the "change" event of the RadioButtonList (not of each RadioButton):



if (this.rawValue != "8")&&(xfa.form.Formular1.superframe.administratormain.computerdistribution.multipleschoolforms == "1")

{

xfa.form.Formular1.superframe.administratormain.administrator3.presence = "visible"

xfa.form.Formular1.superframe.administratormain.administrator4.presence = "visible"

xfa.form.Formular1.superframe.administratormain.administrator5.presence = "visible"

}

else if (this.rawValue != "8")&&(xfa.form.Formular1.superframe.administratormain.computerdistribution.multipleschoolforms == "0")

{

xfa.form.Formular1.superframe.administratormain.administrator5.presence = "hidden"

xfa.form.Formular1.superframe.administratormain.administrator3.presence = "visible"

xfa.form.Formular1.superframe.administratormain.administrator4.presence = "visible"

}

else if (this.rawValue == "8")&&(xfa.form.Formular1.superframe.administratormain.computerdistribution.multipleschoolforms == "0")

{

xfa.form.Formular1.superframe.administratormain.administrator5.presence = "hidden"

xfa.form.Formular1.superframe.administratormain.administrator3.presence = "hidden"

xfa.form.Formular1.superframe.administratormain.administrator4.presence = "hidden"

}

else if (this.rawValue == "8")&&(xfa.form.Formular1.superframe.administratormain.computerdistribution.multipleschoolforms == "1")

{

xfa.form.Formular1.superframe.administratormain.administrator5.presence = "hidden"

xfa.form.Formular1.superframe.administratormain.administrator3.presence = "hidden"

xfa.form.Formular1.superframe.administratormain.administrator4.presence = "hidden"

}



However it does not work as the script has the subforms appear as I check the checkbox but doesn't have them dissappear again once I choose the "rawValue == 8"-option in the RadioButtonList.

Please tell me which event do I have to pick - and why does my script ignore the choices I make in the RadioButtonList ?!
16 Replies

Avatar

Former Community Member
You should only have the script running in one spot ...the change event of the RadioButtonList. As the list is changed the event will fire and your code will execute. Do not put the code on the click event of the RadioButtonList. You can use an app.alert(RadioButonList.rawValue) to show you what the value is directly before you do the compare.

Avatar

Level 2
Dear Paul thanks for answering this quickly I put this code chunk in the change event of the "RadioButtonList" and cleared all the other events of code (they're blank now). However even the app.alert does not fire when I click on one of the options in my radioButtonList.. This is really frustrating...

Why doesn't the code fire?



Here is the code:



Formular1.superframe.administratormain.internetconnection.Optionsfeldliste::change - (JavaScript, client)

app.alert(this.rawValue)

if (this.rawValue != "8")&&(xfa.form.Formular1.superframe.administratormain.computerdistribution.multipleschoolforms == "1")

{

xfa.form.Formular1.superframe.administratormain.administrator3.presence = "visible"

xfa.form.Formular1.superframe.administratormain.administrator4.presence = "visible"

xfa.form.Formular1.superframe.administratormain.administrator5.presence = "visible"

}

else if (this.rawValue != "8")&&(xfa.form.Formular1.superframe.administratormain.computerdistribution.multipleschoolforms == "0")

{

xfa.form.Formular1.superframe.administratormain.administrator5.presence = "hidden"

xfa.form.Formular1.superframe.administratormain.administrator3.presence = "visible"

xfa.form.Formular1.superframe.administratormain.administrator4.presence = "visible"

}

else if (this.rawValue == "8")&&(xfa.form.Formular1.superframe.administratormain.computerdistribution.multipleschoolforms == "0")

{

xfa.form.Formular1.superframe.administratormain.administrator5.presence = "hidden"

xfa.form.Formular1.superframe.administratormain.administrator3.presence = "hidden"

xfa.form.Formular1.superframe.administratormain.administrator4.presence = "hidden"

}

else if (this.rawValue == "8")&&(xfa.form.Formular1.superframe.administratormain.computerdistribution.multipleschoolforms == "1")

{

xfa.form.Formular1.superframe.administratormain.administrator5.presence = "hidden"

xfa.form.Formular1.superframe.administratormain.administrator3.presence = "hidden"

xfa.form.Formular1.superframe.administratormain.administrator4.presence = "hidden"

}

Avatar

Level 2
I forgot the semicolon after

app.alert(this.rawValue)

however still nothing happens...

Avatar

Level 2
The app alert(this.rawValue) alone without any further code fires as expected - and gives exact the rawValues I am working with in the code...

I am completely puzzled....!

Avatar

Level 2
Thanks to your

app.alert(this.rawValue)

I could narrow it down a little - the app.Alert stops firing as soon as I add the second condition - This works:



if(this.rawValue != 8)

{

app.alert(this.rawValue)

}



This doesn't:

if(this.rawValue != 8)&&(xfa.form.Formular1.superframe.administratormain.computerdistribution.multipleschoolforms == 1)

{

app.alert(this.rawValue)

}



although the data binding for the checkbox has been noted down correctly it is 0 and 1 - I don't know what to do about it...

Any suggestions?

Avatar

Former Community Member
Dear Soenke,

You have a syntax problem in if clause. The second contion must be as:



if(this.rawValue != "8" && xfa.form.Formular1.superframe.administratormain.computerdistribution.multipleschoolforms == 1)

{

app.alert(this.rawValue)

}



if(onecondition && secondcontion){

//do anything

}



Hope helps,



Asiye :)

Avatar

Level 2
Unfortunately it still doesn't work...

A pity...

Even with no brackets and



else if(onecond && secondcond)

{

//do whatever

}

added...

It doesn't work...

I really need help here...

Avatar

Former Community Member
If you want to post your form to livecycle8@gmail.com I will have a look. Please include a description of the expected behaviour.

Avatar

Former Community Member
I have had a similar problem with the code not firing in a form with lots of other objects.



However when I copy the two objects interlinked (via an if statement) and paste into a blank form the code fires perfectly!



This behavior is driving me crazy also!



Here's the code - just in case:



if (Discharged_To.rawValue == "SNF" || "Custodial")

DischargedToForm.presence = "visible";

else

DischargedToForm.presence = "hidden";

Avatar

Former Community Member
Are you sure that your form is being rendered as dynamic?

Avatar

Former Community Member
Yes the form is rendered as Dynamic. Under Tools/Options I have selected Dynamic XML Form. Is there any other setting required for a Dynamic form?

Avatar

Former Community Member
Are you doing a preview?



Can you post the form to livecycle8@gmail.com and I will have a look

Avatar

Level 2
Paul did you receive my form - have you had a look on it?!

Avatar

Former Community Member
Paul, I have posted my form per your request.

Avatar

Former Community Member
Thanks Paul! It works! And I also learned to use Alerts! Have a great weekend!