Highlighted

Make a field visible

Avatar

Guest

25-11-2008

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!

Replies

pguerett

25-11-2008

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.
Highlighted

Avatar

Guest

26-11-2008

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?
Highlighted

pguerett

26-11-2008

Add this line of code for debugging before the if statement.



app.alert(this.rawValue)



It will return the value of the RadioButtonlist.