jquery.AreYouSure
jquery.AreYouSure copied to clipboard
Missing <input> tags from tracking when name attribute is not set
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;
}
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.
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.