Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Visible/Invisible Field Issue

Avatar

Former Community Member
Hello All,



My brain is hurting on this one! I have an exclusive radio button group, Yes and No. Trying to get a text box to become visible when the user selects "No."



Here is what I have, under the "No" button, I have the following click event:



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

Main.Subform_1.Comment1.presence = "visible";

}

else{

Main.Subform_1.Comment1.presence = "invisible";

}



Under the "Yes" button, I have the following click event



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

Main.Subform_1.Comment1.presence = "invisible";

}



Something is working because the text field loads up invisible, but the problem is that selecting Yes or No does nothing. To cut out the easy stuff, both scripts are under JavaScript, and the form is a dynamic form.



Not sure if its a script issue, or how the radio buttons are put together.



Any advise would be great.
9 Replies

Avatar

Former Community Member
Karl



If you want the same thing to be done in FormCalc, then I have made a demo PDF for you. Give me your email address so that I can forward it to you, if interested.



In case of any queries, please feel free to contact me.

Thanks.



Syed Hussain Itiba Naqvi

itiba.naqvi@avanzasolutions.com

Avatar

Former Community Member
Ensure that your form is saved as

"Acrobat (Dynamic) XML Form (*.pdf)"



Your code is OK, but when the pdf is saved as STATIC, it does not rerender...

Avatar

Level 4
I tried the same with a static PDF, and it worked when the field is set to "visible" by default, but not when it's set as "invisible" by default...

Avatar

Level 1
I have this same problem. When the default is visible, it works. When the default is invisible it does not. I want the field to be invisible when the form is initially opened.

Avatar

Former Community Member
Try it as a dynamic form and see if it makes a difference

Avatar

Level 1
I set it as Acrobat 7 (Dynamic) XML Form in both the File>Form Propertied>Defaults area and in Tools>Options>Document Handling and still have the same issue. My javascript code is:



----- topmostSubform.Page1.Checkbox1::mouseUp: - (JavaScript, client) ---------------------



if (Checkbox1.rawValue == 1)

{

textfield1.presence = "visible";

textfield2.presence = "visible";

}

else

{

textfield1.presence = "invisible";

textfield2.presence = "invisible";

}



The code work fine, except that if the text field is set to invisible, it does not work at all. If the text field is set to visible, it works, but the initial state when opening the form is visible which I don't want.

Avatar

Former Community Member
Can you change it to be Acrobat 8 Dynamic .....I seem to remember there being a bug in that version but I am not sure. Try it as 8 just to see then we can come up with a work around.

Avatar

Level 1
I tried that and still not working. However I set it to Dynamic. But if I go to File>Save As my only options to save are as static forms. I cannot figure out why. This is a form where there is an underlying image and the fields are on top of it, but I am not sure why that would matter.

Avatar

Former Community Member
That is why ...the underlying image restricts you to a static document. You could leave it as visible but on the Initialize event of the field set it to invisible.