This thread is resolved. Here is a description of the problem and solution.
Problem:
The issue here is that the user wanted to prevent their Toolset form from being submitted unless the user clicks yes to a Popup question after clicking submit.
Solution:
This can be done by using the JS below.
jQuery(document).ready(function(){
$("input[name='form_submit_1']").click(function(event){
event.preventDefault();
if (confirm("Are you sure you want to report this offer as broken?")){
jQuery('form#cred_form_28499_1').submit();
}
});
});
This will prompt the user with a question and only submit the form once the user answers yes to the question.
This support ticket is created 5 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
If you look for the link that says report as broken and click this, this submits a form but I would like it to show a pop up message saying are you sure before it submits the form.
jQuery("input[name='form_submit_1']").click(function(){
if (confirm("Click OK to continue?")){
jQuery('form#cred_form_28499_1').submit();
}else{jQuery("input[name='form_submit_1']").preventDefault()}
});
I cancelled the default option if yes isn't clicked.
I've fixed this for you and should work as intended now .
The correct code is
jQuery(document).ready(function(){
$("input[name='form_submit_1']").click(function(event){
event.preventDefault();
if (confirm("Are you sure you want to report this offer as broken?")){
jQuery('form#cred_form_28499_1').submit();
}
});
});