A Java Script Checkbox that makes a field visible or hidden based on the condition is not functioning properly. When first opening the form, the box does nothing. If I click on "Prepare Form" tool and immediately close, the button works as it should. If Adobe is closed and the form is reopened, the checkbox stops working again.
var nHide = event.target.isBoxChecked(0)?display.visible:display.hidden;
this.getField("Flex Line Type").display = nHide;
Where did you place the code?
I put in on the Checkbox that I want to trigger the change.
Then there's no reason it should launch when the file is opened. It will only launch when you click the field.
That is the problem though. Nothing happens when I click the field. I can check and uncheck the box all I want and nothing will happen. But when I open the "Prepare Form" tool and close it, the checkbox works as it should. I can click it and the field will appear and uncheck it and the field will disappear. But if I close the form (after saving) and reopen it, the checkbox does not work anymore and I have to open the "Prepare Form" tool again.
Can you share the file with us (via Dropbox, Google Drive, Adobe Cloud, etc.)?
What's the field in question?
Never mind, found it (Thermal Oil Flex Lines)... It's working just fine for me.
Change the name of the drop down list and it will work.
That is an odd way to make it work, but for some reason that fixed the problem.
If you want that code to trigger when you open the PDF, then you will need to rewrite it as a document level function and then call that function. It is possible that it can be written to be used as both the mouse up and document level function. But you would need to pass the value of the check box to the called function and then change the visibility of the field based on the return value from the function.
I am not sure I understand how to do what you are suggesting. I am a beginner when it comes to making adobe forms. The problem I am having is that I have the exact same script in another form with a checkbox and it works just fine. I previously used an if/then function but that one gave me the same trouble on this form. There is something about this particular form that is causing problems and I can't figure out what it is.