Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Make a field visible

Not applicable
I have a RadioButtonList with Yes and No as the values. If a user selects yes I want a textbox to appear. I have tried two different click events on the Yes button and haven't had any luck. I have never done any developing before so I am a complete newbie.



first event:

var myDoc = event.target;

var D = myDoc.getField("form1[0].#subform[0].NewFields[0].Description[0]");

D.presence = "visible";



second event:

if(this.rawValue == "Yes"){

form1[0].#subform[0].NewFields[0].Description[0].presence = "visible";}



Can anyone provide me with some assistance. Thanks!
3 Replies
pguerett
Level 10
Level 10
In the hierarchy view the two RadioButtons are underneath a group object. Highlight that group object (RadioButtonList)and then write this code on the exit event of that object:



if (this.rawValue == "Yes"){

D.presence = "visible"

} else {

D.presence = "invisible"

}



The "this" connotation refers to the object that has focus (in our case the RadioButtonList). Note that this is javascript and that your form must be dynamic to have objects appear and disappear programmatically.
Not applicable
Thanks for your help! I added the code to the exit event and I also re-saved the form as a Dynamic form but the field is still not disappearing. I do not get any errors in the debugger. My code now looks like this:



var myDoc = event.target;

var D = myDoc.getField("form1[0].#subform[0].NewFields[0].Description[0]");

if(this.rawValue=="Yes"){

D.presence="visible"

}else{

D.presence="invisible"

}



Any Suggestions?
pguerett
Level 10
Level 10
Add this line of code for debugging before the if statement.



app.alert(this.rawValue)



It will return the value of the RadioButtonlist.