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

Interactive Form issue

Community Beginner ,
Sep 18, 2024 Sep 18, 2024

Copy link to clipboard

Copied

I have a complex to some degree form I am setting up.

 

It includes sections of interactive elements. At the top of each section is a checkbox. If 'checked' i have set up so some fields are then be greyed out (ie not selectable). However I need the option to toggle this on and off and the fields are selectable then not. At the moment if checked and then unchecked the fields remain hidden.

 

Help pleaase

TOPICS
PDF forms

Views

596

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 ,
Sep 18, 2024 Sep 18, 2024

Copy link to clipboard

Copied

You don't show the script you are using or where it is located.  Enter the following mouse up action script in the check box:

if(event.target.value=="Off")

{

this.getField("Field1").readonly=false;

this.getField("Field2").readonly=false;

this.getField("Field3").readonly=false;

}

else

{

this.getField("Field1").readonly=true;

this.getField("Field2").readonly=true;

this.getField("Field3").readonly=true;

}

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 Beginner ,
Sep 18, 2024 Sep 18, 2024

Copy link to clipboard

Copied

I have tried with and without script with no luck.

This is the setup without script. I have about 20 items in one section of the document that i require to be 'greyd' out when the main box is selected then require for them to be editable indicually again when unselected. They grey out they just wont come back.

 

Screenshot 2024-09-19 at 11.45.20 am.png

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 ,
Sep 18, 2024 Sep 18, 2024

Copy link to clipboard

Copied

You can't use mouse down and Show/Hide a field to toggle because you have to test for the status of the fields before changing them.  You have to use a script.  My script makes them "read only" (you said "not selectable").  If you want them read only use the script above and change the field names to the actual field names and put this in a mouse up action.  If you want show/hide the fields, use the following script:

if(event.target.value=="Off")

{

this.getField("Field1").display=display.hidden;

this.getField("Field2").display=display.hidden;

this.getField("Field3").display=display.hidden;

}

else

{

this.getField("Field1").display=display.visible;

this.getField("Field2").display=display.visible;

this.getField("Field3").display=display.visible;

}

 

PDFAutomationStation_0-1726718435687.png

 

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 Beginner ,
Sep 18, 2024 Sep 18, 2024

Copy link to clipboard

Copied

Thanks!

I used the script however still no luck.

 

See below screenshot. When nothing is selected i need all fields to be visble. when the checkbox next to 'select' is checked i need all the highlighted green sections to not be able to be selected and then when toggling back off the 'select' checkbox i need them to then be visible again (this is the part that isnt working)

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 ,
Sep 18, 2024 Sep 18, 2024

Copy link to clipboard

Copied

Please post the actual script you tried.

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 ,
Sep 19, 2024 Sep 19, 2024

Copy link to clipboard

Copied

Unfortunately screenshots don't help.  Check the console for errors and post the script you used.

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 ,
Sep 19, 2024 Sep 19, 2024

Copy link to clipboard

Copied

Did you adjust the code to include the actual field names in your file?

Did you remove all other (non-JS) actions from the field?

Are there any error messages in the JS Console when you click the button?

It would be easier to help you if you could share the actual file with us.

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 Beginner ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

I am still unsure - I cannot share the file as its a confidential client document.

How do i use the below code? 

 

When the checkbox is deselected I want the form to remain as is, when its selected I need items to be greyed out, then if deslected they remain as is again? The below code is showing if event target is off? The document will be 'deafulted to off' if that makes sense and only when selected the the fields hide and show again when selected?

 

if(event.target.value=="Off")

{

this.getField("Field1").display=display.hidden;

this.getField("Field2").display=display.hidden;

this.getField("Field3").display=display.hidden;

}

else

{

this.getField("Field1").display=display.visible;

this.getField("Field2").display=display.visible;

this.getField("Field3").display=display.visible;

}

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 ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

The code above hides the fields when deselected and shows them when selected.  If you want the reverse change the first line to:

if(event.target.value!="Off")

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 Beginner ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

Do you mean 'on' as its currently as 'off'?

 

What would i put in these fields? the document is two pages long so dont want to add all fields as there are a hundred or so?

 

this.getField("Field1").display=display.visible;

this.getField("Field2").display=display.visible;

this.getField("Field3").display=display.visible;

 

In the screenshot attached I will require when select is checked then the green section checkboxes are greyedout ( ie not selectable) then if they toggle it back to unchecked they become visible/selectable 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 ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

!="Off" means 'does not equal off', which means if the box is selected.  Providing a screenshot of the area does not help because I don't know what you named the fields.  You have to name them all in the script I provided instead of Field1, Field2, and Field3.  If it doesn't work there's probably an error.  You can check in the console.

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 Beginner ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

Thanks I managed to get it working and tested 3 fields. Worked great - then i added in the remaining 28 and it didnt work - now it wont work with the 3 either. Does the title effect the script ie if the title has special characters like (-/')?

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 ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

What do you mean by 'title'?  Field name?  Check the console.

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 Beginner ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

Yes - field name. I have gone in and added all the fields now and only the first 8 are working ie showing and not showing. I have checked console and can see the following but it doesnt make sense to 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 Beginner ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

It didnt save some fields - so i think that was the issue working throuigh them now

 

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 Beginner ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

Is there a different script for a similar situation but in this instance there is no master checkbox instead there are two checkboxes 1. Yes, 2. No. When yes is selected no is greyed out and unselected reneabled and visa versa?

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 ,
Sep 24, 2024 Sep 24, 2024

Copy link to clipboard

Copied

How can you select box 2 if it is hidden because box 1 is selected?  Do you mean mutually exclusive check boxes (only one can be check at a time)?  Give them the same name but different export values.

 

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 ,
Sep 25, 2024 Sep 25, 2024

Copy link to clipboard

Copied

LATEST

In Acrobat check the Javascript console (ctrl-j).

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