0
If the form I have is validated, I disable the form, this way:
$("#Editar :input").prop("disabled", true);
But I have a function
that serialize, and if I’m with the forms
disabled, they do not find the value. There is some way to disable the fields, but they are still found ?
This is the function I use, it compares the form when it is loaded, and the form at the time of the action, and how it is disabled, it does not find values.
$(function () {
var init_form = $('#Editar').serialize();
$(':submit').click(function () { window.onbeforeunload = null; }); window.onbeforeunload = function () { var check_form = $('#Editar').serialize(); console.log(check_form); console.log(init_form); if (check_form === init_form) return null; return 'Os dados do formulário não foram salvos, deseja permanecer nesta página?'; };
});
On the console, what appears blank is the var check_form = $('#Editar').serialize();
the other not, how to correct?
It worked fine, thank you.
– Mariana