Expand my Community achievements bar.

Display a subform at run time

Avatar

Former Community Member
I have two diff options and depending on what option I choose different subforms would show on the page? How do I do this?
6 Replies

Avatar

Level 4
The "presence" property controls visibility. I used this script in the click event of a radio button to turn subforms on and off.



xfa.form.form1.Pg1.Subform1.presence = "invisible";

xfa.form.form1.Pg1.Subform2.presence = "visible";



Thom Parker

WindJack Solutions


www.windjack.com

Avatar

Former Community Member
I am trying to do so with a drop down and this code doesnt work.I have to choose one option in the drop down, lets say value=5, the subform shud display rest all values if chosen, the subform shud not be displayed. This code doesnt work for that

Avatar

Level 4
When selecting values off of a drop down list(combobox) you have to use a slightly different approach because your looking for a specific value.



Put the following code in the "change" event for the drop down list



if(xfa.event.newText == "5")

xfa.form.form1.Pg1.Subform1.presence = "invisible";

else

xfa.form.form1.Pg1.Subform1.presence = "visible";



Thom Parker

WindJack Solutions


www.windjack.com

Avatar

Former Community Member
I am still not able to get it right. in the "formready" event of the page I wrote



xfa.form.form1.pg1.subform1.presence="invisible";



so that it is not visible when the form is loaded..it works fine..but when I choose from the drop down list..using the above code..it doesnt work...



but if i donot load it as invisible and then i choose the value (lets say 3) from the drop down it becomes invisible but if i then change the value in drop down(say 2)..it does not become visible again.



I appreciate all your help

Avatar

Former Community Member
Thanks thom..I finally got it..thanks to you as I used the tip u gave to somebody else :) regarding a similar problem..thanks so much

Avatar

Former Community Member
This may sound silly but the same code runs on one machine and doesnt run on other...it hangs tha application and closes