jquery.AreYouSure icon indicating copy to clipboard operation
jquery.AreYouSure copied to clipboard

After Submit It stops working?

Open anup36 opened this issue 10 years ago • 4 comments
trafficstars

Basically i have a Form on submit button am trying to check some conditions of form fields, When I hit the onsubmit button the Page first check all conditions and if any condition not match display error message but the Problem is after clicking onsubmit AreYouSure stops working and if i reload the page not display the Confirmation Box. But after some time later it's start's working properly?

anup36 avatar Oct 20 '15 15:10 anup36

Hi @anup36 . Are you able to provide an example page demonstrating the issue? e.g. a public URL test page, or codepen etc?

codedance avatar Nov 05 '15 10:11 codedance

Create a page with submit button and a validation .Click submit button it will throw some validation .Enter a text field click close.It wont pop up warning.

niketh90 avatar Nov 17 '15 10:11 niketh90

I am seeing a similar thing with an ajax submit. Everything works great until a timer fires a JQuery ajax call that stores a working copy of the form. After the ajax call setting a changed back to its original value still leaves the form dirty. The code is: $(function() { MessageTimer = new $.timer(function() {ClearStatusMessage(2)}, 3000, false); DirtyTimer = new $.timer(SaveRecord, 10000, false); $('form').areYouSure(); $('form').bind('dirty.areYouSure', function() { $(this).find('input[type="submit"]').removeAttr('disabled'); SetStatusText("Needs to be saved.", 1); DirtyTimer.play(); }); $('form').bind('clean.areYouSure', function() { $(this).find('input[type="submit"]').attr('disabled', 'disabled'); ClearStatusMessage(2); ClearStatusMessage(1); DirtyTimer.stop(); MessageTimer.stop(); }); $('input[type="submit"]').attr('disabled', 'disabled'); }); function SaveRecord() { DirtyTimer.stop(); if (! $('#teamform').hasClass('dirty')) { return; } $("#type").val("tmp"); $("#action").val("Update"); var data = $('#teamform').serialize(); $.ajax( { data: data, url: "SaveTeam.php", cache: false }) .done(function(result) //successful ajax call { if(result.indexOf("Error") < 0) { SetStatusText("Temporary copy saved.", 2); } else { SetStatusText("Temporary copy failed.", 2); } }); // $("#teamform").trigger('reinitialize.areYouSure'); MessageTimer.play(); DirtyTimer.play(); }

sreed4 avatar Dec 17 '15 00:12 sreed4

I can confirm this issue using MVC 5's unobtrusive validation. If I had to hazard a guess I'd say it's just to do with the ordering of the submit handlers? I have no idea how you resolve that though.

tboby avatar Feb 16 '16 10:02 tboby