1
I’m here with a problem validating my form, every time I change the country I reload the page:
<select class="form-control" id="pais" name="pais"
onchange="document.getElementById('form_user').action='';this.form.submit();">
I do this to add new fields if the country is Portugal.
The problem is I’m using the validate Jquery and the validation of this and other fields disappears when changing the country, because I reload the page.
How can I keep the validation fields always working, from the moment I click for once on the button of Submit?
How I do the validation:
$('#form_user').validate({
rules: {
nome: {
minlength: 3,
maxlength: 50,
required: true
},
//outros campos...
pais: {
valueNotEquals: "0"
}
}
//mensagens, etc...
});
It would not be the case to use ajax to get the list of countries?
– Beterraba
What for? My validation is whether or not you selected a country.
– Jorge B.
Oh yes, I got the question wrong. I thought you were reloading the page to get the list of states and municipalities, for example.
– Beterraba