Expand my Community achievements bar.

Invisible and Visible

Avatar

Former Community Member
I want my user to select one of three radio buttons and have a drop down list appear as a result. For each selection there is a separate drop down list.



Each drop down is invisible; selection of radio button determines which drop down becomes visible.



I cannot make the drop down list visible when I click on a radio button.



My code (in the on click event at the radio butoon)is

--> form1.page1.DropDownListX.presence == "visible" <-- end code, where "DropDownListX" is the drop down list I want visible.



Can some kind and helpful person here aid me please?



Thanks,

Chris
9 Replies

Avatar

Former Community Member
I also tried unsuccessfully with "=" in lieu of "==".



Chris

Avatar

Former Community Member
I have been playing around with this and got it work with this.



DropDownList1.presence = "visible";

DropDownList2.presence = "invisible";



The trouble I found with this method is that I would click and the drop down list field would disappear but the radio button would not be selected and I would have to click it again.



I found a sample file that has this code in the calculate event of a text field.



if (rb1.rawValue == "1")

{

this.presence = "visible";

}

else

{

this.presence = "invisible";

}

this.rawValue;



I tried it out with a calculate event for one of the drop down lists and it works. Just change the rb1 to name of your radio button group.

Avatar

Former Community Member
I assume you have JavaScript selected for the language in the script editor.



Do you want me to send you something that I got to work as a sample?

Avatar

Former Community Member
Yes, I caught that early on! Please, addy is webmaster@petsatlanta.com. Thanks.

Avatar

Former Community Member
I also tried this script without success. Couled you please send me the code as well?



Thanks



Nelson

Avatar

Former Community Member
Let's say you create a new radio button group by dragging three radio buttons onto a form. Then you place a drop down list next to each button, name these drop down lists "DropDownListX" where "X" is 1-3 and make them invisible by setting the Presence property on the Object palette's Field tab to
invisible. You can achieve the effect you're looking for by placing the following code on each radio button's Click event (in FormCalc):



DropDownList1.presence = "visible"

DropDownList2.presence = "invisible"

DropDownList3.presence = "invisible"


Of course, this is the code for the first radio button which, when clicked, will show DropDownList1. I chose FormCalc here because it was a simple script but you could just as easily do the same in JavaScript:



DropDownList1.presence = "visible";

DropDownList2.presence = "invisible";

DropDownList3.presence = "invisible";


The only difference, in this case, is the mandatory semicolon at the end of each line.



Stefan

Adobe Systems

Avatar

Former Community Member
I have a similar problem, but I am using a dropdown list as the mandatory. This dropdown list has more than one condition to be invisible/visible. My question: how can I put in the If loop more than one condition?

Thanks in advance

Avatar

Former Community Member
The simple way would be to nest if statements. The nicer way would be to use the logiucal AND (&&) and logical OR operators (||). ie:



if ( (cond1 && cond2) || cond3) {

...

}



This can sometimes be tricky, so if you having trouble you may want to just use the "ugly" way and nest if statements with single conditions.



Chris

Adobe Enterprise Developer Support