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

Avatar

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

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.

Avatar

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?

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.