I can’t control form Focus and field validation

Asked

Viewed 43 times

0

I am in the following situation, I have three formularies, which are displayed through the event click the buttons associated with them, disable the buttons and try to validate the fields of each form, before being shown, has an image that disappears when clicked on the button, but when I click on the button of some form, it comes back and enables the buttons again. I need to keep track of the send buttons of each form and show both even when entering the validation, however, this is not happening.

1) Form:

<div class="container-links">                                                                 
      <a class="btn btn-1" id="btn-reg1">Cliente 1</a> 
      <a class="btn btn-2" id="btn-reg2">Cliente 2</a>
      <a class="btn btn-3" id="btn-reg3">Cliente 3</a>                                                            
 </div> 
 <div class="imagem"><img src="images/pessoa.jpg"></div>
 <form id="pesquisadorForm" method="post">
     <div class="form-group                                               
       <input type="text" name="nome" placeholder="Nome completo"                    class="form-control">                                                                                                                                                                                                                                                                                                                                                                        
     </div>                                                 

     <div class="form-group">
        <input type="text" name="cpf" placeholder="CPF" class="form-control">                                                                                                                         
     </div>

     <div class="form-group">
       <input type="text" name="fone"  placeholder="Telefone" class="form-control">                                                                                                                         
    </div>

    <div class="form-group">
      <input type="text" name="email" placeholder="Email" class="form-control">                                                                                                                          
    </div>

    <div class="form-group">
        <input type="text" name="instituicao" placeholder="Institui&ccedil;&atilde;o" class="form-control">                                                                                                                         
    </div>
 <div class="container-fluid">
    button type="submit" class="btn btn-primary btn-block" name="btnPqdr" id="btnPqdr">Salvar Informa&ccedil;&otilde;es</button>                                                                            
 </div>                                                                                                                                                  
 </form>

2) Form

<form method="post" class="registration-form">
<div class="form-group">                                          
     <input type="text" name="nome" placeholder="Nome completo" class="form-control" >
</div>                                                            
<div class="form-group">                                        
  <input type="text" name="ocupacao" placeholder="Ocupa&ccedil;&atilde;o" class="form-control">
</div>
<div class="form-group">                                        
 <input type="text" name="idade" placeholder="Idade" class="form-control">
</div>                              
<div class="form-group">                                        
  <input type="text" name="cidade" placeholder="Cidade" class="form-control">
</div>
<div class="form-group">                                        
  <input type="text" name="uf" placeholder="UF" class="form-address form-control" id="form-address">
</div>
<div class="container-fluid">
     <button type="submit" class="btn btn-primary btn-block">Salvar Informa&ccedil;&otilde;es</button>                              
</div>
</form>
  • I don’t know if this solves the problem, but I noticed that you use elements of form 1 and 2 with the same name, differentiate them because the DOM will only refer to the first one you find

  • My fault, I did not put these values as they are here, for example, in the first form, the input to the name, had put in the attribute name so, "lbm-pesqd-name", and for all the rest, I continued defining with this idea, only changing the last name, and so defined for the other two forms.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.