Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Jan 02, 2019 Jan 02, 2019

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;

TOPICS
Acrobat SDK and JavaScript , Windows
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 03, 2019 Jan 03, 2019

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

Translate
Community Expert ,
Jan 02, 2019 Jan 02, 2019

Where did you place the code?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2019 Jan 02, 2019

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2019 Jan 02, 2019

As a MouseUp action?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2019 Jan 02, 2019

Correct.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2019 Jan 02, 2019

Then there's no reason it should launch when the file is opened. It will only launch when you click the field.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2019 Jan 02, 2019

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2019 Jan 02, 2019

Can you share the file with us (via Dropbox, Google Drive, Adobe Cloud, etc.)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2019 Jan 02, 2019
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2019 Jan 02, 2019

What's the field in question?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2019 Jan 02, 2019

Never mind, found it (Thermal Oil Flex Lines)... It's working just fine for me.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 03, 2019 Jan 03, 2019

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 03, 2019 Jan 03, 2019
LATEST

That is an odd way to make it work, but for some reason that fixed the problem.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 02, 2019 Jan 02, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2019 Jan 02, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines