codedance / jquery.AreYouSure

A light-weight jQuery "dirty forms" Plugin - it monitors html forms and alerts users to unsaved changes if they attempt to close the browser or navigate away from the page. (Are you sure?)
508 stars 145 forks source link

Cannot undirty if there is a disabled field #96

Open sky3913 opened 8 years ago

sky3913 commented 8 years ago

I have disabled dropdown in my page. It will be enabled if the previous dropdown is selected (cascade dropdown). If I made a changes and view the source a class="dirty" will be added into the <form> tag, then if I removed the changes (back to the initial state) the dirty class is not removed.

Then, I tried to remove disabled attribute in the dropdown and everything is going to work well. Doesn't it work if there is a disabled field?

davidp1978 commented 8 years ago

I had a similar issue. You probably don't want the dropdowns to be checked for dirtyness. Consider adding the ays-ignore class or data-ays-ignore attribute: Field 2: (ignored): <input type="text" name="field2" data-ays-ignore="true"> <br /> Field 3: (ignored): <input type="text" name="field3" class="ays-ignore"> <br />

sky3913 commented 8 years ago

@davidp1978 Actually, I want this plugin work if there is a disabled field, but in the fact, it doesn't work.