Expand my Community achievements bar.

Show/Hide Controls using JavaScript

Avatar

Former Community Member
Hi...



I have created a RadioButtonList with two radio buttons, namely, VISIBLE and HIDDEN. Clicking on VISIBLE must show/display the text box on the document whereas, clicking on HIDDEN must hide the textbox.



For this to happen, I have written the following javascript under form1.#subform[0].RadioButtonList[0]::click event



var generavPE=xfa.resolveNode("RadioButtonList.RadioButton1");

if(generavPE.formattedValue==0)

{

TextField1.presence="hidden";

}

else

{

TextField1.presence="visible";

}



But, this has no effect on the textbox control. Can anyone please give me a solution to overcome this.



Thanks,

Khader.
3 Replies

Avatar

Former Community Member
Hey Khader,



First thing, make sure the file is saved as a dynamic pdf.



If this still doesn't fix it, just a few things...



The current object (where the click event is) can be accessed by using either $ or this



Set the language to Javascript and do something like:



if (this.rawValue == 1)

xfa.resolveNode("TextField1").presence="hidden";

else

xfa.resolveNode("TextField1").presence="visible";



Hope that helps.

Cheers,

:Damien

Avatar

Former Community Member

thanks Damien n Khader...i too had this problem...