Jump to content
Fórum Script Brasil
  • 0

Apartir De Um Valor De Um Drop List Abiliar Um Campo


Loki
 Share

Question

Bem preciso habilitar um campo apartir de um valor de um drop list

tipo...

Tenho la meu

<td>Possui filhos?<br><br></td>
    <td width="47"><select name="filhos" class="style3" />
                    <option value="0" label="Selecionar"></option>
                      <option value="1" label="Sim"></option>
                      <option value="2" label="Não"></option></td>
    <td width="269">Quantos: <input type="text" name="qts_filhos" size="2" maxlength="2" disabled /></td>

Ai quando o cara colocar o value "1"(Sim) ele habilita o input text para ele pode colocar o numero de filhos.

Estou usando JSP na parte de processo da pagina.

Edited by Loki
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

olha um exemplo aí

<select name="filhos" onchange="java script:verifica(this.value);" />
<option value="">Escolha...</option>
<option value="s">Sim</option>
<option value="n">Não</option>
</select>
Quantos: <input id="flhs" type="text" name="qts_filhos" size="2" maxlength="2" disabled="disabled" />
function verifica(valor){
    if(valor == 's'){
        document.getElementById('flhs').disabled = false;
    }else{
        document.getElementById('flhs').value = '';
        document.getElementById('flhs').disabled = true;
    }
}

abraço

Link to comment
Share on other sites

  • 0

mais ou menos assim:

<br>Possui filhos?<br><br>
<select name="filhos" class="style3" onchange="java script:if(this.selectedIndex==1){document.getElementById('qts_filhos').disabled='';}else{document.getElementById('qts_filhos').disabled='disabled';}">
    <option value="0">Selecionar</option>
    <option value="1">Sim</option>
    <option value="2">Não</option>
</select>
<br>Quantos: <input type="text" name="qts_filhos" id="qts_filhos" size="2" maxlength="2" disabled />

sucesso ai,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.2k
    • Total Posts
      647.5k
×
×
  • Create New...