Expand my Community achievements bar.

Make visible at Open of document

Avatar

Former Community Member
I have a form created where items are invisible at the opening of the document. They open and close depending on the choices the user makes. It turns on visible and invisible. I have drop down lists that control which stuff is visible, but the only problem is when the customer saves it and we open it everything becomes invisible as the initial setting. I need something to check the values on those things and then make them visible to see and print without us doing anything. Here is the simplest one. to give you an idea of what I'm doing.



This java script makes BidPassword visible or invisible:



Main.Form.BidReqPass::change - (JavaScript, client)

switch(xfa.event.newText){

case 'Yes':

BidPassword.presence= "visible";

break;

case 'No':

BidPassword.presence= "invisible";

break;

}



I have tried:



Main.Form.BidPassword::docReady - (JavaScript, client)

if (BidReqPass.rawValue= "Yes") {

BidPassword.presenc = "visible";

} else (BidReqPass.rawValue= "No") {

BidPassword.presence= "invisible";

}



but it doesn't work. I think I am close, but I can't figure it out exactly. I'm on PC and ES 8.2 with 9Pro. Any help is appreciated. I don't know if I should put the script on the BidReqPass (item controlling if BidPassword is visible) or BidPassword (item changing) and how to do if I can do it.



Thank.
7 Replies

Avatar

Former Community Member
If you are using version 9 then in the File/Form Properties/Deafults menu you can choose to have the form remember your state changes. Set it to automatically and you shoudl not have to code it.

Avatar

Former Community Member
Wow it was that simple the whole time. Thanks very much.

Avatar

Former Community Member
Hi Paul,



I am having the same problem but the items on my form are visible at the opening of the form. These fields are visible based on the selection that the users select from the drop down list (DDL). My code is also similar to the one above but it is not working right.

I am using ES 8.2 with Acrobat Pro 8.1.3 and Acrobat Reader 9.0. Can you please help.



Thanks,

Han Dao

Avatar

Level 10
b Paul:



Doh! Missed that, I just went through and scripted a bunch of conditionals for keeping fields open on reopening a form!



I'll test that out to see if it works for me.



b Han Dao:



In the Initialize event for the fields you want hidden you can put

> this.presence = "invisible";

Avatar

Level 10
b Paul:

That setting doesn't seem to want to remember the visibility of subforms.



b Michael:

What I've done is put scripts in the Initialize event of the hidden fields that look for the state of the item that makes them visible.



example - this javascript (checks to see if a checkbox is on or off when the form is opened and sets the visibility of the object accordingly:



>if (Order.BWCheck.rawValue == 1){

this.presence = "visible";

}

else {

this.presence = "hidden";

}



That's the only way I can seem to keep the subform visibility on reopening a saved form.

Avatar

Level 10
Hi,



Just to add this in to the mix.



When we have this requirement we sometimes take the script out and put it in the calculate event of an invisible field. This way we have the script in one place, rather than an exit event and initialise event.



N.

Avatar

Level 10
On thinking about this over the weekend I'm wondering if I'm going about it incorrectly.



To make the subforms hidden when I open the document I have "this.presence = "hidden;"" in their initialize event. Should I be doing this somewhere else?



I've just tested it using the Presence setting on the object palette. Going this route seems to remember the state of visibility on reopening the form.



There must be a better way of working on this. I've got hidden subforms within hidden subforms. I'm still building this form and to work on it and test it I'm going to be spending half my time changing the Presence setting on the object palette.



Unless there's a way to have hidden/invisible objects still show in Design View?



Or is the way I'm doing it -- a script on the hidden object checking the state of the button that controls its visibility -- the way to go about it.