3
I have a form and 1 function to validate each field of this form
function valida_nome() {
}
function valida_email() {
}
function valida_tel() {
}
function valida_senha() {
}
<form id="usuario_form" name="usuarios_form" method="POST" action="#">
<input type="text" id="input_nome_cad" class="input nome_cad" name="nome_cad" placeholder="Nome e Sobrenome" onblur="valida_nome(this)">
<br/>
<input type="text" id="input_email_cad"class="input email_cad"name="email_cad" placeholder="Insira o Email" onblur="valida_email(this)">
<br/>
<input type="text" id="input_conf_email_cad"class="input conf_email_cad"name="conf_email_cad" placeholder="Confirme seu email" ><br/>
<input type="text" id="input_tel_cad" class="input tel_cad" name="tel_cad" placeholder="Insira um telefone"><br/>
<input type="text"id="input_conf_tel_cad" class="input tel_cad" name="conf_tel_cad" placeholder="Confirme o telefone">
<br/>
<input type="password" id="input_senha_cad"class="input senha_cad" name="senha_cad" placeholder="Insira uma senha"><br/>
<input type="password" id="input_conf_senha_cad" class="input senha_cad" name="conf_senha_cad" placeholder="Confirme a senha">
<input type="submit" class="btn_enviar_cad" name="enviar_cad" value="Criar Conta" onclick="return valida_form(this)">
</form>
I would like a function from an event onload
, performing all four functions, that is to say a function valida_form
that would perform the functions valida_nome
, valida_email
, valida_tel
, valida_senha
.
Questions:
- Where is the place and how to proceed in the
onload
? - Nesting functions in javascript, if this term is correct?
Were the answers below helpful? Were you able to solve the problem?
– Sergio