CRITICA DE CAMPOS
Tenho este formulário abaixo e gostaria de criticar os campos name,phone,email,decision_time. Fiz duas funções abaixo: [txt-color=#e80000]function valida_campo()[/txt-color] (para não deixar entrar dados em branco), [txt-color=#0000f0]function confere()[/txt-color] (nao deixar entrar end. de e-mail não válido). Só que não está criticando.
<head>
<style type=[Ô]text/css[Ô]>
.style1
{
background-color: #E5E6FA;
font-family: Tahoma;
font-weight: 700;
}
.style2
{
width: 124px;
color: #000099;
}
.normal
{
background-color: #FFFFFF;
}
.style3
{
background-color: #E5E6FA;
font-family: Tahoma;
font-weight: 700;
width: 125px;
}
.style4
{
background-color: #E5E6FA;
}
.style5
{
background-color: #E5E6FA;
font-family: Tahoma;
font-weight: 700;
width: 125px;
color: #000099;
}
</style>
</head>
<script language=[Ô]javascript[Ô]>
[txt-color=#e80000]function valida_campo()[/txt-color]
{
<!--
var name = document.form.name.value
if (name==[Ô][Ô]){
alert([Ô]Entre com seu nome![Ô]);
document.form.name.focus()
return false
}
var phone = document.form.phone.value
if (phone==[Ô][Ô]){
alert([Ô]Entre com seu telefone![Ô]);
document.form.phone.focus()
return false
}
var email=document.form.email.value;
if (email==[Ô][Ô]){
alert([Ô]Entre com seu email![Ô])
document.form.email.focus()
return false
}
}
var decision_time=document.form.decision_time.value;
if (decision_time==[Ô][Ô]){
alert([Ô]Faça o comentário![Ô])
document.form.decision_time.focus()
return false
}
}
[txt-color=#e80000]function confere()[/txt-color]{
if (document.form.email.value.indexOf([ô]@[ô], 0) == -1 || document.form.email.value.indexOf([ô].[ô], 0) == -1){ alert([Ô]E-mail invalido![Ô]);
document.form.email.focus()
}
}
//-->
</script>
<body bgcolor=[Ô]#eaeaea[Ô] style=[Ô]background-color: #E5E6FA[Ô]>
<form method=[Ô]POST[Ô] action=[Ô]send.asp[Ô] name=[Ô]form[Ô] onsubmit=[Ô]return valida_campo()[Ô]>
<table cellSpacing=[Ô]0[Ô] cellPadding=[Ô]0[Ô] width=[Ô]409[Ô] bgColor=[Ô]#ffffff[Ô]
style=[Ô]background-color: #E5E6FA; font-family: Tahoma; font-weight: 700;[Ô]>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]> Nome:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô] style=[Ô]background-color: #FFCC00[Ô]>
<input maxLength=[Ô]30[Ô] size=[Ô]30[Ô] name=[Ô]name[Ô] style=[Ô]font-family: Tahoma[Ô]></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>Telefone com DDD:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô]><input maxLength=[Ô]25[Ô] size=[Ô]30[Ô] name=[Ô]phone[Ô]
style=[Ô]font-family: Tahoma[Ô]></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>Endereço:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô]><input maxLength=[Ô]30[Ô] size=[Ô]30[Ô]
name=[Ô]address[Ô] style=[Ô]font-family: Tahoma[Ô]></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>Cidade:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô]><input maxLength=[Ô]30[Ô] size=[Ô]30[Ô] name=[Ô]city[Ô]
style=[Ô]font-family: Tahoma[Ô]></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>UF:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô] size=[Ô]2[Ô]><select size=[Ô]1[Ô] name=[Ô]State[Ô]
style=[Ô]font-family: Tahoma[Ô]>
<option value=[Ô][Ô] selected>Estado</option>
<option value=[Ô]AC[Ô] >Acre</option>
<option value=[Ô]AL[Ô] >Alagoas</option>
<option value=[Ô]AP[Ô]>Amapá</option>
<option value=[Ô]AM[Ô] >Amazonas</option>
<option value=[Ô]BA[Ô] >Bahia</option>
<option value=[Ô]CE[Ô]>Ceará</option>
<option value=[Ô]DF[Ô]>Distrito Federal</option>
<option value=[Ô]ES[Ô]>Espírito Santo</option>
<option value=[Ô]GO[Ô] >Goias</option>
<option value=[Ô]MA[Ô]>Maranhão</option>
<option value=[Ô]MT[Ô]>Mato Grosso</option>
<option value=[Ô]MS[Ô]>Mato Grosso do Sul</option>
<option value=[Ô]MG[Ô]>Minas Gerais</option>
<option value=[Ô]PA[Ô]>Pará</option>
<option value=[Ô]PB[Ô]>Paraíba</option>
<option value=[Ô]PR[Ô]>Paraná</option>
<option value=[Ô]PE[Ô] >Pernambuco</option>
<option value=[Ô]PI[Ô]>Piauí</option>
<option value=[Ô]RJ[Ô]>Rio de Janeiro</option>
<option value=[Ô]RN[Ô]>Rio Grande do Norte</option>
<option value=[Ô]RS[Ô]>Rio Grande do Sul</option>
<option value=[Ô]RO[Ô]>Rondônia</option>
<option value=[Ô]RR[Ô] >Roraima</option>
<option value=[Ô]SC[Ô]>Santa Catarina</option>
<option value=[Ô]SP[Ô]>São Paulo</option>
<option value=[Ô]SE[Ô] >Sergipe</option>
<option value=[Ô]TO[Ô] >Tocantins</option>
</select></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>CEP:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô]><input maxLength=[Ô]30[Ô] size=[Ô]19[Ô] name=[Ô]zip[Ô]
style=[Ô]font-family: Tahoma[Ô]></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>Email:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô]>
<input maxLength=[Ô]30[Ô] size=[Ô]30[Ô] name=[Ô]email[Ô] onBlur=[Ô]confere()[Ô]
style=[Ô]font-family: Tahoma[Ô]>
</font></td>
</tr>
</table>
<font face=[Ô]Arial[Ô] size=[Ô]2[Ô]>
</font>
<table cellSpacing=[Ô]0[Ô] cellPadding=[Ô]0[Ô] width=[Ô]409[Ô] bgColor=[Ô]#ffffff[Ô]
style=[Ô]height: 285px[Ô]>
<tr>
<td height=[Ô]22[Ô] class=[Ô]style3[Ô]> </td>
<td height=[Ô]22[Ô] class=[Ô]style1[Ô]> </td>
</tr>
<tr>
<td height=[Ô]22[Ô] class=[Ô]style5[Ô]><font size=[Ô]2[Ô]>Assunto :</font></td>
<td height=[Ô]22[Ô] class=[Ô]style1[Ô]><font face=[Ô]Arial[Ô]><select size=[Ô]1[Ô]
name=[Ô]decision_time[Ô] style=[Ô]font-family: Tahoma[Ô]>
<option value=[Ô]Sugestão[Ô] selected>Sugestão</option>
<option value=[Ô]Elogio[Ô]>Elogio</option>
<option value=[Ô]CrÃtica[Ô]>CrÃtica</option>
<option value=[Ô]Dúvidas sobre Equipamentos[Ô]>Dúvidas sobre Equipamentos</option>
<option value=[Ô]Dúvidas sobre Produtos[Ô]>Dúvidas sobre Produtos</option>
</select></font></td>
</tr>
<tr>
<td height=[Ô]15[Ô] class=[Ô]style5[Ô]> </td>
<td height=[Ô]15[Ô] class=[Ô]style1[Ô]> </td>
</tr>
<tr>
<td height=[Ô]99[Ô] valign=[Ô]top[Ô] class=[Ô]style5[Ô]>
<font size=[Ô]2[Ô]
style=[Ô]background-color: #E5E6FA[Ô]>Mensagem:</font></td>
<td height=[Ô]99[Ô] class=[Ô]style1[Ô]><font face=[Ô]Arial[Ô]>
<textarea name=[Ô]special_details[Ô] wrap=[Ô]Virtual[Ô] cols=[Ô]30[Ô]
style=[Ô]font-family: Tahoma; height: 164px;[Ô]></textarea></font></td>
</tr>
</table>
<p style=[Ô]text-align: center[Ô]> <font face=[Ô]Arial[Ô]><input type=[Ô]submit[Ô]
value=[Ô]Enviar[Ô]>
</font></p>
</form>
<p style=[Ô]text-align: center[Ô]>
</p>
<head>
<style type=[Ô]text/css[Ô]>
.style1
{
background-color: #E5E6FA;
font-family: Tahoma;
font-weight: 700;
}
.style2
{
width: 124px;
color: #000099;
}
.normal
{
background-color: #FFFFFF;
}
.style3
{
background-color: #E5E6FA;
font-family: Tahoma;
font-weight: 700;
width: 125px;
}
.style4
{
background-color: #E5E6FA;
}
.style5
{
background-color: #E5E6FA;
font-family: Tahoma;
font-weight: 700;
width: 125px;
color: #000099;
}
</style>
</head>
<script language=[Ô]javascript[Ô]>
[txt-color=#e80000]function valida_campo()[/txt-color]
{
<!--
var name = document.form.name.value
if (name==[Ô][Ô]){
alert([Ô]Entre com seu nome![Ô]);
document.form.name.focus()
return false
}
var phone = document.form.phone.value
if (phone==[Ô][Ô]){
alert([Ô]Entre com seu telefone![Ô]);
document.form.phone.focus()
return false
}
var email=document.form.email.value;
if (email==[Ô][Ô]){
alert([Ô]Entre com seu email![Ô])
document.form.email.focus()
return false
}
}
var decision_time=document.form.decision_time.value;
if (decision_time==[Ô][Ô]){
alert([Ô]Faça o comentário![Ô])
document.form.decision_time.focus()
return false
}
}
[txt-color=#e80000]function confere()[/txt-color]{
if (document.form.email.value.indexOf([ô]@[ô], 0) == -1 || document.form.email.value.indexOf([ô].[ô], 0) == -1){ alert([Ô]E-mail invalido![Ô]);
document.form.email.focus()
}
}
//-->
</script>
<body bgcolor=[Ô]#eaeaea[Ô] style=[Ô]background-color: #E5E6FA[Ô]>
<form method=[Ô]POST[Ô] action=[Ô]send.asp[Ô] name=[Ô]form[Ô] onsubmit=[Ô]return valida_campo()[Ô]>
<table cellSpacing=[Ô]0[Ô] cellPadding=[Ô]0[Ô] width=[Ô]409[Ô] bgColor=[Ô]#ffffff[Ô]
style=[Ô]background-color: #E5E6FA; font-family: Tahoma; font-weight: 700;[Ô]>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]> Nome:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô] style=[Ô]background-color: #FFCC00[Ô]>
<input maxLength=[Ô]30[Ô] size=[Ô]30[Ô] name=[Ô]name[Ô] style=[Ô]font-family: Tahoma[Ô]></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>Telefone com DDD:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô]><input maxLength=[Ô]25[Ô] size=[Ô]30[Ô] name=[Ô]phone[Ô]
style=[Ô]font-family: Tahoma[Ô]></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>Endereço:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô]><input maxLength=[Ô]30[Ô] size=[Ô]30[Ô]
name=[Ô]address[Ô] style=[Ô]font-family: Tahoma[Ô]></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>Cidade:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô]><input maxLength=[Ô]30[Ô] size=[Ô]30[Ô] name=[Ô]city[Ô]
style=[Ô]font-family: Tahoma[Ô]></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>UF:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô] size=[Ô]2[Ô]><select size=[Ô]1[Ô] name=[Ô]State[Ô]
style=[Ô]font-family: Tahoma[Ô]>
<option value=[Ô][Ô] selected>Estado</option>
<option value=[Ô]AC[Ô] >Acre</option>
<option value=[Ô]AL[Ô] >Alagoas</option>
<option value=[Ô]AP[Ô]>Amapá</option>
<option value=[Ô]AM[Ô] >Amazonas</option>
<option value=[Ô]BA[Ô] >Bahia</option>
<option value=[Ô]CE[Ô]>Ceará</option>
<option value=[Ô]DF[Ô]>Distrito Federal</option>
<option value=[Ô]ES[Ô]>Espírito Santo</option>
<option value=[Ô]GO[Ô] >Goias</option>
<option value=[Ô]MA[Ô]>Maranhão</option>
<option value=[Ô]MT[Ô]>Mato Grosso</option>
<option value=[Ô]MS[Ô]>Mato Grosso do Sul</option>
<option value=[Ô]MG[Ô]>Minas Gerais</option>
<option value=[Ô]PA[Ô]>Pará</option>
<option value=[Ô]PB[Ô]>Paraíba</option>
<option value=[Ô]PR[Ô]>Paraná</option>
<option value=[Ô]PE[Ô] >Pernambuco</option>
<option value=[Ô]PI[Ô]>Piauí</option>
<option value=[Ô]RJ[Ô]>Rio de Janeiro</option>
<option value=[Ô]RN[Ô]>Rio Grande do Norte</option>
<option value=[Ô]RS[Ô]>Rio Grande do Sul</option>
<option value=[Ô]RO[Ô]>Rondônia</option>
<option value=[Ô]RR[Ô] >Roraima</option>
<option value=[Ô]SC[Ô]>Santa Catarina</option>
<option value=[Ô]SP[Ô]>São Paulo</option>
<option value=[Ô]SE[Ô] >Sergipe</option>
<option value=[Ô]TO[Ô] >Tocantins</option>
</select></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>CEP:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô]><input maxLength=[Ô]30[Ô] size=[Ô]19[Ô] name=[Ô]zip[Ô]
style=[Ô]font-family: Tahoma[Ô]></font></td>
</tr>
<tr>
<td class=[Ô]style2[Ô]><font size=[Ô]2[Ô]>Email:</font></td>
<td class=[Ô]style4[Ô]><font face=[Ô]Arial[Ô]>
<input maxLength=[Ô]30[Ô] size=[Ô]30[Ô] name=[Ô]email[Ô] onBlur=[Ô]confere()[Ô]
style=[Ô]font-family: Tahoma[Ô]>
</font></td>
</tr>
</table>
<font face=[Ô]Arial[Ô] size=[Ô]2[Ô]>
</font>
<table cellSpacing=[Ô]0[Ô] cellPadding=[Ô]0[Ô] width=[Ô]409[Ô] bgColor=[Ô]#ffffff[Ô]
style=[Ô]height: 285px[Ô]>
<tr>
<td height=[Ô]22[Ô] class=[Ô]style3[Ô]> </td>
<td height=[Ô]22[Ô] class=[Ô]style1[Ô]> </td>
</tr>
<tr>
<td height=[Ô]22[Ô] class=[Ô]style5[Ô]><font size=[Ô]2[Ô]>Assunto :</font></td>
<td height=[Ô]22[Ô] class=[Ô]style1[Ô]><font face=[Ô]Arial[Ô]><select size=[Ô]1[Ô]
name=[Ô]decision_time[Ô] style=[Ô]font-family: Tahoma[Ô]>
<option value=[Ô]Sugestão[Ô] selected>Sugestão</option>
<option value=[Ô]Elogio[Ô]>Elogio</option>
<option value=[Ô]CrÃtica[Ô]>CrÃtica</option>
<option value=[Ô]Dúvidas sobre Equipamentos[Ô]>Dúvidas sobre Equipamentos</option>
<option value=[Ô]Dúvidas sobre Produtos[Ô]>Dúvidas sobre Produtos</option>
</select></font></td>
</tr>
<tr>
<td height=[Ô]15[Ô] class=[Ô]style5[Ô]> </td>
<td height=[Ô]15[Ô] class=[Ô]style1[Ô]> </td>
</tr>
<tr>
<td height=[Ô]99[Ô] valign=[Ô]top[Ô] class=[Ô]style5[Ô]>
<font size=[Ô]2[Ô]
style=[Ô]background-color: #E5E6FA[Ô]>Mensagem:</font></td>
<td height=[Ô]99[Ô] class=[Ô]style1[Ô]><font face=[Ô]Arial[Ô]>
<textarea name=[Ô]special_details[Ô] wrap=[Ô]Virtual[Ô] cols=[Ô]30[Ô]
style=[Ô]font-family: Tahoma; height: 164px;[Ô]></textarea></font></td>
</tr>
</table>
<p style=[Ô]text-align: center[Ô]> <font face=[Ô]Arial[Ô]><input type=[Ô]submit[Ô]
value=[Ô]Enviar[Ô]>
</font></p>
</form>
<p style=[Ô]text-align: center[Ô]>
</p>
Resolvi o problema, retirei as funções acima e no inÃcio do arquivo send.asp que chamo no formulario acima coloquei o seguinte código:
<%
[ô]
[ô]
session ([Ô]name[Ô]) = request.form([Ô]name[Ô])
if session([Ô]name[Ô])=empty then
Response.Redirect [Ô]mens.html[Ô] redireciono para uma página
end if
session ([Ô]phone[Ô]) = request.form([Ô]phone[Ô])
if session([Ô]phone[Ô]) = empty then
response.write [Ô] Preencha o telefone!!![Ô]
end if
%>
<%
[ô]
[ô]
session ([Ô]name[Ô]) = request.form([Ô]name[Ô])
if session([Ô]name[Ô])=empty then
Response.Redirect [Ô]mens.html[Ô] redireciono para uma página
end if
session ([Ô]phone[Ô]) = request.form([Ô]phone[Ô])
if session([Ô]phone[Ô]) = empty then
response.write [Ô] Preencha o telefone!!![Ô]
end if
%>
Tópico encerrado , respostas não são mais permitidas