You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a problem when applying this code.
It works perfectly fine with the fields that is already written in the HTML.
But, I have a form that allows the user to add a new input field by using JavaScript. The problem is that it doesn't check the new input fields added by JavaScript.
Is there a way to make this code work with the new added fields?
Many thanks,
The text was updated successfully, but these errors were encountered:
/*
* If you're dynamically adding new fields/inputs, and would like to track
* their state, trigger Are-You-Sure to rescan the form like this:
*/
$('#my-form').trigger('rescan.areYouSure');
As far as I can tell (from experimentation), doing $('#my-form').trigger('rescan.areYouSure'); will reset the "dirty" flag on the form, which isn't necessarily what is wanted.
For example, I might have a checkbox which the user checks (marking the form as dirty), and a button which the user then clicks to add a file-upload control to the form dynamically. If I rescan as suggested, it seems to reset the form to clean.
I am open to being proven wrong but that's what seemed to be happening to me.
Hello,
Thank you for the code!
I have a problem when applying this code.
It works perfectly fine with the fields that is already written in the HTML.
But, I have a form that allows the user to add a new input field by using JavaScript. The problem is that it doesn't check the new input fields added by JavaScript.
Is there a way to make this code work with the new added fields?
Many thanks,
The text was updated successfully, but these errors were encountered: