Jump to content
leoretorico

[Resolvido] Validar campos

Recommended Posts

leoretorico

Boa tarde amigos!

Como posso no código abaixo acrescentar uma mensagem se os campos não estiverem preenchidos?E no campo senha(password) ocultar os dados digitados com **** ???

<script type="text/javascript">

<!--

function authPass(u,p) {

if (u && p) self.location = "auth.htm?" + u + p;

return false;

}

// -->

</script>

<div>

<script type="text/javascript">

<!--

if (location.search.indexOf("auth=failed") != -1) {

document.write("<span style=\"color:#ff0000\">Acesso negado! Verifique seu login</span>");

}

// -->

</script>

<form id="form1" action="javascript://" onsubmit="return authPass(this.user.value,this.pass.value)">

<table>

<tr>

<td>Usuário: </td><td><input type="text" name="user" /></td>

</tr>

<tr>

<td>Senha: </td><td><input type="text" name="pass" /></td>

</tr>

<tr>

<td colspan="4" align="left"><input type="submit" value="Login" /><input type="button" name="reset_form" value="Limpar campos" onclick="this.form.reset();" /></td>

</tr>

</table>

</form>

</div>

Share this post


Link to post
Share on other sites
fteixeira1993

<input type="password" name="pass">

E no campo senha(password) ocultar os dados digitados com **** ???

<input type="password" name="pass">

Edited by fteixeira1993

Share this post


Link to post
Share on other sites
leoretorico

Obrigado amigo..agora o password fica oculto ao digitar!

Mas como posso exibir uma mensagem se não for digitado nada e o usuário clicar no botão login?

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.


×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.