Home › Forums › General discussion › Code for form to take automatic action
- This topic has 5 replies, 2 voices, and was last updated 4 years, 8 months ago by Alexander Bautz.
-
AuthorPosts
-
-
February 25, 2020 at 23:49 #28885
Hello,
I’m trying to determine what code to use on dffs for the form to take the following actions.
When user clicks on a checkbox from the main tab, I want the form to take the following actions:
1. Save the changes made to the record
2. Prompt a pop-up with a question with “yes/no” options (if user selects “no” just close the form)
3. If user selects “yes” take user to second tab within the same form for the rest of the information to be completed.Thanks in advance
-
February 26, 2020 at 09:28 #28889
Hi,
Will this be used to in NewForm and if the user selects Yes, redirect to EditForm to continue?Alexander
-
February 26, 2020 at 14:28 #28893
Hi Alex – No. The user would be in edit form (tab 1) and when completing that form and clicking the last checkbox, then the prompt would appear and if user selects yes, it would take him to the next tab (tab 2) also in edit form.
-
February 26, 2020 at 20:09 #28899
Do you need to save the form first, or just prompt the user if the form should save and exit, or continue to tab #2?
Alexander
-
February 26, 2020 at 22:25 #28901
Hi Alex,
I added a quick mockup to this response. Hopefully that helps.
Let me know!
Attachments:
-
February 27, 2020 at 17:06 #28909
You can use something like the below snippet, but if you actually are in EditForm already you need to use some rules to hide the second tab initially and then show it when you save the form and are redirected.
jQuery("#dffs_Acknowledge input").on("click", function() { if (jQuery(this).prop("checked")) { spjs.modal.add({ "title": "", "html": "Thank you for completing the form. Will you be willing to fill out a 2 min survey?", "allowMaximize": false, "showClose": false, "resizable": false, "ok": function() { spjs.dffs.redirect(location.href+"&sTab=1"); spjs.dffs.triggerSave(); }, "cancel": function() { spjs.dffs.triggerSave(); } }); } });
Replace “Acknowledge” with the internal name of your Yes/No field.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.