javascript - How can I re-enable a JQuery script after a failed validation in a primefaces page? -
ok here's deal... have primefaces page, , i'm modifying style-class
of components using jquery script. problem that, after failed validation of fields, script stops modifying style-class
style fails components. i'm trying refresh page using update="@form"
on submit button, won't work validation ajax level. refreshing page manually works not desirable, , won't keep nor error messages neither field values validated without errors.
i can guess script doing it's working on dom-elements changed or replaced ajax-call. example:
$(document).ready(function() { $('input').on('change', function() { $(this).add('class', 'changed'); }); });
this script registers event on input-fields it's finding after dom ready. if ajax-call adds new input field or rerenders 1 of input-elements don't have automatically registered events on them.
you need register events after ajax-call again via e.g. oncomplete="registerevents();"
registerevents
same things did in $(document).ready
function.
beware of registering events multiple times on same element.
Comments
Post a Comment