How to confirm before submit process

Confluence User - 28 Oct, 2016

This is my code ,

<script type="text/javascript">
$(document).ready(function(){
$("#assignmentComplete").on("click", function(){
     if(confirm("Are you sure to send email ?")){
          return true;
     }else{
          return false;
     }
});
});
</script>



And this is , On submit form

 

And this is , On click cancel

 

 

Why, I don't see 'Please wait...'


Please Help Me!!!

 

forms

5


28 Oct, 2016
confluenceUser
confluenceUser

Hi Sa Varee

There is two possible submit id "#assignmentComplete or #submit", just add a "#submit" to your jquery as follows:

<script type="text/javascript">
    $(document).ready(function() {
        $("#assignmentComplete,#submit").on("click", function() {
            if (confirm("Are you sure to send email ?")) {
                return true;
            } else {
                return false;
            }
        });
    });
</script>
31 Oct, 2016
confluenceUser
1
confluenceUser

I have improved Matthew's code to handle Joget v5 use of blockUI.

$(document).ready(function() {
		//cancel default click event in 1 second
		setTimeout(function(){
		    //uncomment this while loop if fails to remove default click event
			//while( $("#section-actions button, #section-actions input").data("events") ){
			  $("#section-actions button, #section-actions input").off("click");
			//}
			
			$("#assignmentComplete,#submit").on("click", function(event) {
				if (confirm("Are you sure to send email ?")) {
					$.blockUI({ css: { 
						border: 'none', 
						padding: '15px', 
						backgroundColor: '#000', 
						'-webkit-border-radius': '10px', 
						'-moz-border-radius': '10px', 
						opacity: .3, 
						color: '#fff' 
					}, message : "<h1>Please wait...</h1>" }); 
					return true;
				} else {
					return false;
				}
			});
		}, 1000);
    });
31 Oct, 2016
confluenceUser
confluenceUser

Oh, Thank You Very Much

25 Oct, 2021
confluenceUser
confluenceUser

Where can we insert this code in the form?


14 May, 2025
confluenceUser
confluenceUser

I didn't understand the reason of setTimeout

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print