Skip to main content
Participating Frequently
January 2, 2019
Answered

Check Box Java Script won't work unless I open and close form tool

  • January 2, 2019
  • 2 replies
  • 1416 views

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;

This topic has been closed for replies.
Correct answer Bernd Alheit

https://libertyuniv-my.sharepoint.com/:b:/g/personal/cbean1_liberty_edu/EaQdM6_BAZ9IlsDNGTwOjQwBB58gtyeG3wy306GrQt1xhg?e…


Change the name of the drop down list and it will work.

2 replies

Inspiring
January 2, 2019

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.

Participating Frequently
January 2, 2019

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.

try67
Community Expert
Community Expert
January 2, 2019

Where did you place the code?

Participating Frequently
January 2, 2019

I put in on the Checkbox that I want to trigger the change.

try67
Community Expert
Community Expert
January 2, 2019

As a MouseUp action?