Boas a todos,
Estou com um problema ao criar um botão para preencher um campo.
A ver se alguém me consegue explicar como posso fazer.
Tenho um local (Código postal) que será para introduzir 4 números e depois mais 3 números.
Agora aqui tenho o problema:
Tenho um botão e quero que ele pegue os 7 números e verifique se existe esse código postal para preencher dois campos sem sair da pagina do formulário.
Código (HTML):
Estou com um problema ao criar um botão para preencher um campo.
A ver se alguém me consegue explicar como posso fazer.
Tenho um local (Código postal) que será para introduzir 4 números e depois mais 3 números.
Agora aqui tenho o problema:
Tenho um botão e quero que ele pegue os 7 números e verifique se existe esse código postal para preencher dois campos sem sair da pagina do formulário.
Código (HTML):
<p><center><h3><strong>Código Postal: </strong>
<input type="Integer" name="Cp" maxlength="4" size="4"> - <input type="Integer" name="Cp2" maxlength="3" size="1">
<button type="button" style='width: 100px' value="#botao">Automático</button></center></p><br>
<p><center><h3><strong>Morada: </strong>
<input type="text" name="Morada"></center></p><br>
<p><center><h3><strong>Distrito: </strong>
<input type="text" name="Distrito"></center>
<p><center><h3><strong>Concelho: </strong>
<input type="text" name="Concelho"></center>
<input type="Integer" name="Cp" maxlength="4" size="4"> - <input type="Integer" name="Cp2" maxlength="3" size="1">
<button type="button" style='width: 100px' value="#botao">Automático</button></center></p><br>
<p><center><h3><strong>Morada: </strong>
<input type="text" name="Morada"></center></p><br>
<p><center><h3><strong>Distrito: </strong>
<input type="text" name="Distrito"></center>
<p><center><h3><strong>Concelho: </strong>
<input type="text" name="Concelho"></center>