I have this button:
<div class="grid_17">
<button value="novaPesquisa" class="btn-pular-passo pull-right" id="btnEndereco">Continuar</button>
</div>
There is a <form>
big, where this button is inserted, all divided by DIV's. Well, it turns out that some DIV's, they enter with Display="none"
and they will only be visible, at the click of this button. I have done a blank field validation and then, when there are blank fields, already shows a hint in the component itself saying that field needs to be filled. Well, I have the following problems. The validation function, it takes the whole form and all the DIVs, including the button and those that are hide
, are within this form. Oh, I ask? Does it work or do I have to create two forms: one for the fields that already appear and the button and another form for those that are hidden or not? And how do I do this on the button, ie whether they were validated or not? Below is the jQuery function to validate.
var validateOptions = {
ignore: "",
errorElement: false,
highlight: function (field) {
$(field).addClass('has-error').removeClass('has-success');
},
unhighlight: function (field) {
$(field).addClass('has-success').removeClass('has-error');
},
errorPlacement: function () {
}
};
$('#formConfirmaDados').data('validate', $('#formConfirmaDados').validate(validateOptions));