Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
In the mouse up action:
if(event.target.value=="Off")
{//your reset script}
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
Please post your script.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Use like this:
var fieldsToReset = ["Text1","Text23"];//add more field names if needed
if(event.target.value == "Off"){
this.resetForm(fieldsToReset);}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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 ".
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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.