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

Are You Sure Plugin Is not working properly

Open debu83 opened this issue 11 years ago • 4 comments

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'));
            }
        };

debu83 avatar Aug 07 '13 05:08 debu83

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.

codedance avatar Sep 29 '13 11:09 codedance

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 avatar Oct 06 '13 23:10 TimNZ

@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!

codedance avatar Oct 07 '13 00:10 codedance

Thanks. Passing { fieldSelector: 'select,textarea,input' } for now.

TimNZ avatar Oct 07 '13 00:10 TimNZ