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

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

New Here ,
Jan 02, 2019 Jan 02, 2019

Copy link to clipboard

Copied

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

Views

863

Translate

Translate

Report

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.

Votes

Translate

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

Copy link to clipboard

Copied

Where did you place the code?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

As a MouseUp action?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Correct.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

What's the field in question?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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