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

Deselecting a checkbox and Reset a form

Explorer ,
Mar 07, 2025 Mar 07, 2025

Hello!

I have a section on my interactive form where I created a mouse up action to reset a form on a set of checkboxes. 

 

Is there a way to also have a deselect option so if one item is deselected it will reset that specific checkbox?

 

Thank you so much for your help!

TOPICS
Create PDFs , Edit and convert PDFs , How to , Modern Acrobat , PDF , PDF forms
351
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 ,
Mar 07, 2025 Mar 07, 2025

In the mouse up action:

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

{//your reset script}

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
Explorer ,
Mar 07, 2025 Mar 07, 2025

Thank you so much for your reply. 

Do I add the above script as a separate mouse up action using Java Script? When I did that it did not work. I put the name of the field in place of "your reset script" and it did not take. What am I missing? I am new to JavaScript. 

 

Thank you so much!

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 ,
Mar 08, 2025 Mar 08, 2025

Please post your script.

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
Explorer ,
Mar 10, 2025 Mar 10, 2025

Hello!

I did not create a script. I used the Reset a Form Mouse Up action and I manually selected the fields that should reset once my Reset Button is clicked. 

 

I attached the photo of the "Action" I used. 

There are a group of fields that will reset when the reset button is clicked. 

 

In addition to the group of fields resetting when the reset button is clicked, I would also like to uncheck an individual box that will deselect the option. 

 

I hope I didn't make your head explode. 

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 ,
Mar 10, 2025 Mar 10, 2025

Use like this:

var fieldsToReset = ["Text1","Text23"];//add more field names if needed
if(event.target.value == "Off"){
 this.resetForm(fieldsToReset);}
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
Explorer ,
Mar 10, 2025 Mar 10, 2025

Thank you so much, Nesa, but I am clearly doing something wrong. I am getting an illegal character 1: at line 2. I'm not sure where I am going wrong. I have uploaded the script for additional assistance. 

 

Thank you so much 

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 ,
Mar 10, 2025 Mar 10, 2025

All of your quotatation marks are illegal chararters because they are curly quotes, not straight quotes like in the script you copied and pasted from @Nesa Nurani .  Use a plain text editor, like Notepad to write your scripts and you won't have this issue.  You can use Notepad to do a find and replace (Ctrl + h) and replace all 

“ and ” with ".

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
Explorer ,
Mar 11, 2025 Mar 11, 2025

Thank you! I was able to chnage out my curly quotes and replace them correctly. Thank you for that info. 

Next, I went to the Mouse Up action where I have the Reset a form and added a Mouse Up trigger with  Run A JavaScript action and added the script. When I tested the deselect of the checkbox, the information was still listed. 

 

To be clear:

1. I have a Reset form that when the checkbox is selected, the contents appear on a separate section. 

2. My current Mouse Up action resets the entire section when the Reset button is enacted. 

3. I now want to also deselect one checkbox making the previous contents disappear when deselected. 

 

Thank you so much for your patience!

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 ,
Mar 11, 2025 Mar 11, 2025
LATEST

The script provided clears all the fields listed when the box is clicked and unselected (export value is "Off").  If it doesn't do this it is either conflicting with another action you have in the check box (everything should be in a script if you are using a script), or you have errors - check the console.

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