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

Missing <input> tags from tracking when name attribute is not set

Open tbutterwith opened this issue 10 years ago • 2 comments
trafficstars

If an input tag is missing the name attribute <input type='text' id='input'> then it is completely ignored from the dirty forms tracking.

Lines 28-34 (jquery.areYouSure.js) clearly show this as the intention but it's not listed in the docs

 var getValue = function ($field) {
            if ($field.hasClass('ays-ignore')
                || $field.hasClass('aysIgnore')
                || $field.attr('data-ays-ignore')
                || $field.attr('name') === undefined) {
                return null;
            }

tbutterwith avatar Sep 15 '15 07:09 tbutterwith

Oh. Sorry for the late reply. The github notification ended up in my span bin!

If the field does not have a name attribute it will not be submitted in a form post. The thinking is if it can't modify the post, then the form is not dirty. Do you have a use-case where you need to change this behaviour. I'd be keen to understand. Maybe we could consider putting a configuration option in if required.

codedance avatar Oct 13 '15 23:10 codedance

Working within a BackboneJs environment submitting forms using the MVC framework. Input tags use data-model-attrib attribute rather than name to identify them when submitting the data.

tbutterwith avatar Oct 14 '15 08:10 tbutterwith