Galera, fiz um formulario e to precisando colocar campos obrigatorios nele, do tipo, se o cara nao digitar o nome, nao envia
eu coloquei os formularios em
www.carolsystem.com.br
quem puder ajudar,
valeu
Luis Henrique
Formulario
Started By luissiq, 27/11/2003, 15:44
4 replies to this topic
#1
Posted 27/11/2003, 15:44
#2
Posted 27/11/2003, 15:56
Qual dream vc usa???
Bom se for o dream mx faz assim, vai na "aba" behairvors e clica naquela "setinha" e escolhe a opção "validete form", ok
Qualquer coisa de um grito aqui!
Bom se for o dream mx faz assim, vai na "aba" behairvors e clica naquela "setinha" e escolhe a opção "validete form", ok
Qualquer coisa de um grito aqui!
Rodrigo Thiago
Web Developer ASP/COLDFUSION/MYSQL/SQL-SERVER
rodrigo.thiago@gmail.com
white monkeys - Mande sua proposta / solicite seu orçamento
Web Developer ASP/COLDFUSION/MYSQL/SQL-SERVER
rodrigo.thiago@gmail.com
white monkeys - Mande sua proposta / solicite seu orçamento
#3
Posted 27/11/2003, 16:09
Entao amigo, eu uso o dreamweaver mx ., eu consegui fazer isso que vc disse, so que os capos ficam assim : UNNAMED , eu ja coloquei nome neles no canto do campo, mas nao sei se tem que colocar em outro lugar...
Obrigado
luis henrique
Obrigado
luis henrique
#4
Posted 27/11/2003, 21:42
vc pode apelar para JS mesmo , vai aqui um exemplo de um formulario com validacao (pessoal deesculpe o tamanho do post)
<html>
<head>
<title>Js Validação</title>
<script Language="JavaScript">
<!--
/*
###############################
# #
# .......:::::::: BY SK15 ® :::::::.......... #
# NÃO TIRE OS DIREITOS AUTORAIS #
# #
#############################
*/
function checa_formulario(icqlist){
if (icqlist.nick.value == ""){
alert("Por Favor Coloque Seu Nick !!!");
icqlist.nick.focus();
return (false);
}
if (icqlist.email.value == ""){
alert("O Campo E-mail está Vazio !!!");
icqlist.email.focus();
return (false);
}
if (icqlist.email.value.indexOf('@', 0) == -1){
alert("O E-mail é Ivalido !!!");
icqlist.email.focus();
return (false);
}
if (icqlist.icq.value == ""){
alert("O campo ICQ Está Vazio !!!");
icqlist.icq.focus();
return (false);
}
var ver_numero = "1234567890";
var sk15 = icqlist.icq.value;
var invalido = true;
for (i = 0; i < sk15.length; i++){
ch = sk15.charAt(i);
for (j = 0; j < ver_numero.length; j++)
if (ch == ver_numero.charAt(j))
break;
if (j == ver_numero.length){
invalido = false;
break;
}}
if (!invalido){
alert("O Campo ICQ Deve Conter Apenas Números !!!");
icqlist.icq.focus();
return (false);
}
if (icqlist.icq.value.length < 7){
alert("O campo ICQ Deve Ter No Minimo 7 Números !!!")
icqlist.icq.focus();
return (false);
}
if (icqlist.icq.value.length > 10){
alert("O campo ICQ Deve Ter No Maximo 10 Numeros !!!")
icqlist.icq.focus();
return (false);
}
if (icqlist.senha.value == ""){
alert("O campo senha Está Vazio !!!");
icqlist.senha.focus();
return (false);
}
if (icqlist.senha.value.length < 4){
alert("O campo senha Deve Ter No Minimo 4 Números !!!")
icqlist.senha.focus();
return (false);
}
if (icqlist.senha.value.length > 8){
alert("O campo senha Deve Ter No Maximo 8 Números !!!")
icqlist.senha.focus();
return (false);
}
if (icqlist.senha2.value == ""){
alert("O campo Comfirma senha Está Vazio !!!");
icqlist.senha2.focus();
return (false);
}
if (icqlist.senha.value != icqlist.senha2.value){
alert("A Senha do Comfirma Senha é diferenete do 1º Campo !!!");
icqlist.senha2.focus();
return (false);
}
if (icqlist.idade.value == ""){
alert("O campo Idade Está Vazio !!!");
icqlist.idade.focus();
return (false);
}
if (icqlist.idade.value.length > 2){
alert("O campo Idade Deve Ter No Maximo 2 Números !!!")
icqlist.idade.focus();
return (false);
}
var ver_numero = "1234567890";
var sk15 = icqlist.idade.value;
var invalido = true;
for (i = 0; i < sk15.length; i++){
ch = sk15.charAt(i);
for (j = 0; j < ver_numero.length; j++)
if (ch == ver_numero.charAt(j))
break;
if (j == ver_numero.length){
invalido = false;
break;
}}
if (!invalido){
alert("O Campo Idade Deve Conter Apenas Números !!!");
icqlist.idade.focus();
return (false);
}
if (icqlist.sexo.value == "selecione"){
alert("Por Favor Selecione Um Sexo !!!");
icqlist.sexo.focus();
return (false);
}
if (icqlist.cidade.value == ""){
alert("O campo Cidade Está Vazio !!!");
icqlist.cidade.focus();
return (false);
}
if (icqlist.homepage.value == "http://"){
alert("O campo Home-Page Está Vazio !!!");
icqlist.homepage.focus();
return (false);
}
return (true);
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF">
<p align="center"><br>
</p>
<form onsubmit="return checa_formulario(this)" name="icqlist" action="cad.html" method="post">
<div align="center"><center>
<table border="0" cellspacing="1" cellpading="0">
<tr>
<td><font size="2" face="Verdana">Nick: </font></td>
<td><input type="text" size="20" name="nick"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">E-mail:</font></td>
<td><input type="text" size="20" name="email"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">ICQ:</font></td>
<td><input type="text" size="20" name="icq"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Senha:</font></td>
<td><input type="password" size="20" name="senha"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Confirmar senha:</font></td>
<td><input type="password" size="20" name="senha2"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Idade:</font></td>
<td><input type="text" size="20" name="idade"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Sexo:</font></td>
<td><select name="sexo" size="1">
<option selected value="selecione">Selecione</option>
<option value="M">Masculino</option>
<option value="F">Feminino</option>
</select></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Cidade:</font></td>
<td><input type="text" size="20" name="cidade"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Home-Page:</font></td>
<td><input type="text" size="20" name="homepage" value="http://"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input type="reset" name="limpa"
value="Limpar"> <input
type="submit" name="cadastro" value="Cadastrar"></td>
</tr>
</table>
</center></div>
</form>
<p align="center"><br>
</p>
</body>
</html>
Falow
[]s
<html>
<head>
<title>Js Validação</title>
<script Language="JavaScript">
<!--
/*
###############################
# #
# .......:::::::: BY SK15 ® :::::::.......... #
# NÃO TIRE OS DIREITOS AUTORAIS #
# #
#############################
*/
function checa_formulario(icqlist){
if (icqlist.nick.value == ""){
alert("Por Favor Coloque Seu Nick !!!");
icqlist.nick.focus();
return (false);
}
if (icqlist.email.value == ""){
alert("O Campo E-mail está Vazio !!!");
icqlist.email.focus();
return (false);
}
if (icqlist.email.value.indexOf('@', 0) == -1){
alert("O E-mail é Ivalido !!!");
icqlist.email.focus();
return (false);
}
if (icqlist.icq.value == ""){
alert("O campo ICQ Está Vazio !!!");
icqlist.icq.focus();
return (false);
}
var ver_numero = "1234567890";
var sk15 = icqlist.icq.value;
var invalido = true;
for (i = 0; i < sk15.length; i++){
ch = sk15.charAt(i);
for (j = 0; j < ver_numero.length; j++)
if (ch == ver_numero.charAt(j))
break;
if (j == ver_numero.length){
invalido = false;
break;
}}
if (!invalido){
alert("O Campo ICQ Deve Conter Apenas Números !!!");
icqlist.icq.focus();
return (false);
}
if (icqlist.icq.value.length < 7){
alert("O campo ICQ Deve Ter No Minimo 7 Números !!!")
icqlist.icq.focus();
return (false);
}
if (icqlist.icq.value.length > 10){
alert("O campo ICQ Deve Ter No Maximo 10 Numeros !!!")
icqlist.icq.focus();
return (false);
}
if (icqlist.senha.value == ""){
alert("O campo senha Está Vazio !!!");
icqlist.senha.focus();
return (false);
}
if (icqlist.senha.value.length < 4){
alert("O campo senha Deve Ter No Minimo 4 Números !!!")
icqlist.senha.focus();
return (false);
}
if (icqlist.senha.value.length > 8){
alert("O campo senha Deve Ter No Maximo 8 Números !!!")
icqlist.senha.focus();
return (false);
}
if (icqlist.senha2.value == ""){
alert("O campo Comfirma senha Está Vazio !!!");
icqlist.senha2.focus();
return (false);
}
if (icqlist.senha.value != icqlist.senha2.value){
alert("A Senha do Comfirma Senha é diferenete do 1º Campo !!!");
icqlist.senha2.focus();
return (false);
}
if (icqlist.idade.value == ""){
alert("O campo Idade Está Vazio !!!");
icqlist.idade.focus();
return (false);
}
if (icqlist.idade.value.length > 2){
alert("O campo Idade Deve Ter No Maximo 2 Números !!!")
icqlist.idade.focus();
return (false);
}
var ver_numero = "1234567890";
var sk15 = icqlist.idade.value;
var invalido = true;
for (i = 0; i < sk15.length; i++){
ch = sk15.charAt(i);
for (j = 0; j < ver_numero.length; j++)
if (ch == ver_numero.charAt(j))
break;
if (j == ver_numero.length){
invalido = false;
break;
}}
if (!invalido){
alert("O Campo Idade Deve Conter Apenas Números !!!");
icqlist.idade.focus();
return (false);
}
if (icqlist.sexo.value == "selecione"){
alert("Por Favor Selecione Um Sexo !!!");
icqlist.sexo.focus();
return (false);
}
if (icqlist.cidade.value == ""){
alert("O campo Cidade Está Vazio !!!");
icqlist.cidade.focus();
return (false);
}
if (icqlist.homepage.value == "http://"){
alert("O campo Home-Page Está Vazio !!!");
icqlist.homepage.focus();
return (false);
}
return (true);
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF">
<p align="center"><br>
</p>
<form onsubmit="return checa_formulario(this)" name="icqlist" action="cad.html" method="post">
<div align="center"><center>
<table border="0" cellspacing="1" cellpading="0">
<tr>
<td><font size="2" face="Verdana">Nick: </font></td>
<td><input type="text" size="20" name="nick"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">E-mail:</font></td>
<td><input type="text" size="20" name="email"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">ICQ:</font></td>
<td><input type="text" size="20" name="icq"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Senha:</font></td>
<td><input type="password" size="20" name="senha"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Confirmar senha:</font></td>
<td><input type="password" size="20" name="senha2"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Idade:</font></td>
<td><input type="text" size="20" name="idade"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Sexo:</font></td>
<td><select name="sexo" size="1">
<option selected value="selecione">Selecione</option>
<option value="M">Masculino</option>
<option value="F">Feminino</option>
</select></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Cidade:</font></td>
<td><input type="text" size="20" name="cidade"></td>
</tr>
<tr>
<td><font size="2" face="Verdana">Home-Page:</font></td>
<td><input type="text" size="20" name="homepage" value="http://"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input type="reset" name="limpa"
value="Limpar"> <input
type="submit" name="cadastro" value="Cadastrar"></td>
</tr>
</table>
</center></div>
</form>
<p align="center"><br>
</p>
</body>
</html>
Falow
[]s
+-----------------------------------------------------------------------------------------------------------
UH Terêrê ... Voltei!
UH Terêrê ... Voltei!
#5
Posted 29/11/2003, 14:19
Olá!Entao amigo, eu uso o dreamweaver mx ., eu consegui fazer isso que vc disse, so que os capos ficam assim : UNNAMED , eu ja coloquei nome neles no canto do campo, mas nao sei se tem que colocar em outro lugar...
Obrigado
luis henrique
Atribua um nome ao campo, então use o "Validade Form".
<input type="text" name="exemplo">
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)










