jquery.AreYouSure
jquery.AreYouSure copied to clipboard
Are You Sure Plugin Is not working properly
Suppose you have a page called FirstPage with one date field. After page loaded sucessfully , populated value of this date filed is 03/06/2013 .
Now you click the SecondPage Link without changing any values in FirstPage , but till the popup is comming .
Solution : We have Fixed this issue by changing the jquery.are-you-sure.js file, below is the change code -------------------------------------------------OLD----------------------------------------------------------------- var checkForm = function(evt) { var isFieldDirty = function($field) { return (getValue($field) != $field.data('ays-orig'));
};
-------------------------------------------------NEW----------------------------------------------------------------- var checkForm = function (evt) { var isFieldDirty = function ($field) {
if ((getValue($field).match(/^\d\d?\/\d\d?\/\d\d\d\d$/)) && ($field.data('ays-orig').match(/^\d\d?\/\d\d?\/\d\d\d\d$/))) {
var getDate = getValue($field).split('/');
var orgDate = $field.data('ays-orig').split('/');
getDate = parseInt(getDate[0], 10) + "/" + parseInt(getDate[1], 10) + "/" + parseInt(getDate[2], 10);
orgDate = parseInt(orgDate[0], 10) + "/" + parseInt(orgDate[1], 10) + "/" + parseInt(orgDate[2], 10);
return (getDate != orgDate);
}
else {
return (getValue($field) != $field.data('ays-orig'));
}
};
I assume this issue is referring to the HTML5 date field. By default Are-You-Sure will not pick this input field type up. It's however pretty trivial to add.
I've done a bit of experimenting and haven't been able to reproduce this issue (on Chrome, Safari and Firefox). Is it an IE10 issue? The "value" of an input[type='date'] should be returned in a consistent YYYY-MM-DD format.
I'll leave this issue open. I'd welcome feedback on the importance (or growing importance) for the requirement to support date fields.
Is there a good reason for including the newer html5 input types including email? If so, update the README to clarify the default fieldSelector value and other options.
Otherwise, really nice work mate, it just works.
@TimNZ Agree. I think they should be included. I'll milestone this for the 1.5 release. My only hesitation in pushing this in the last release (1.4) was testing. All field types needs to be tested across all the different browsers... A good job for a rainy day!
Thanks. Passing { fieldSelector: 'select,textarea,input' } for now.