paulafernandes
03-27-2003, 12:27 PM
Hi everyone!
I have this ASP page with some JavaScript:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function checkFields() {
missinginfo = "";
if (document.forml.pre.value == "inv")
{
missinginfo += "\n - Data";
}
if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}
// End -->
</script>
</HEAD>
<BODY>
<form name = "forml" action = "1.asp" onsubmit = "return checkFields();">
<table border="1" width="100%">
<tr>
<td width="18%">
<select id="select11" name="dia1">
<option></option>
<%
d=1
while d<32
Response.Write ("<OPTION ")
if dn <> "" then
if cint (Request.Form("dia"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
if d<10 then
Response.Write ("0")
end if
Response.Write (d & "'>" )
if d<10 then
Response.Write ( "0" & d & "</OPTION>")
else Response.Write (d & "</OPTION>")
end if
d=d+1
wend
%>
</select>
/ <select id="select12" name="mes1">
<option></option>
<%
d=1
while d<13
Response.Write ("<OPTION ")
if mn <> "" then
if cint (Request.Form("mes"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
if d<10 then
Response.Write ("0")
end if
Response.Write (d & "'>" )
if d<10 then
Response.Write ( "0" & d & "</OPTION>")
else Response.Write (d & "</OPTION>")
end if
d=d+1
wend
%>
</select>
/ <select id="select13" name="ano1">
<option></option>
<%
d=year(date)
while d>1900
Response.Write ("<OPTION ")
if an <> "" then
if cint (Request.Form("ano"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
Response.Write (d & "'>" & d & "</OPTION>")
d=d-1
wend
%>
</select>
</td>
<td width="18%">
<select id="select11" name="dia2">
<option></option>
<%
d=1
while d<32
Response.Write ("<OPTION ")
if dn <> "" then
if cint (Request.Form("dia"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
if d<10 then
Response.Write ("0")
end if
Response.Write (d & "'>" )
if d<10 then
Response.Write ( "0" & d & "</OPTION>")
else Response.Write (d & "</OPTION>")
end if
d=d+1
wend
%>
</select>
/ <select id="select12" name="mes2">
<option></option>
<%
d=1
while d<13
Response.Write ("<OPTION ")
if mn <> "" then
if cint (Request.Form("mes"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
if d<10 then
Response.Write ("0")
end if
Response.Write (d & "'>" )
if d<10 then
Response.Write ( "0" & d & "</OPTION>")
else Response.Write (d & "</OPTION>")
end if
d=d+1
wend
%>
</select>
/ <select id="select13" name="ano2">
<option></option>
<%
d=year(date)
while d>1900
Response.Write ("<OPTION ")
if an <> "" then
if cint (Request.Form("ano"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
Response.Write (d & "'>" & d & "</OPTION>")
d=d-1
wend
%>
</select>
<%
if request("dia1") <> "" then
val = "p"
else val = "v"
end if
if request("mes1") <> "" then
val = val + ",p"
else val = val + ",v"
end if
if request("ano1") <> "" then
val = val + ",p"
else val = val + ",v"
end if
if request("dia2") <> "" then
val = val + ",p"
else val = val + ",v"
end if
if request("mes2") <> "" then
val = val + ",p"
else val = val + ",v"
end if
if request("ano2") <> "" then
val = val + ",p"
else val = val + ",v" &"<br>"
end if
pr = 0
vz = 0
mystr = split (val, ",", -1, 1)
for i = 0 to 5
'Response.Write mystr(i) & "<br>"
if mystr(i) = "p" then
pr = pr + 1
end if
next
if (pr >= 1 or pr < 6) then%>
<INPUT type="text" id=text1 name="pre" value = "inv">
<%end if%>
</td>
<td width="64%"><input type="submit" value="Submit" name="B1">
</td>
</tr>
</table>
</form>
What I'm trying to do is to make sure that or no combos are selected or all are.
The alert appears on both situations, I can't validate this right.
Any sugestions? Please?...
Thank's
Paula
I have this ASP page with some JavaScript:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function checkFields() {
missinginfo = "";
if (document.forml.pre.value == "inv")
{
missinginfo += "\n - Data";
}
if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}
// End -->
</script>
</HEAD>
<BODY>
<form name = "forml" action = "1.asp" onsubmit = "return checkFields();">
<table border="1" width="100%">
<tr>
<td width="18%">
<select id="select11" name="dia1">
<option></option>
<%
d=1
while d<32
Response.Write ("<OPTION ")
if dn <> "" then
if cint (Request.Form("dia"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
if d<10 then
Response.Write ("0")
end if
Response.Write (d & "'>" )
if d<10 then
Response.Write ( "0" & d & "</OPTION>")
else Response.Write (d & "</OPTION>")
end if
d=d+1
wend
%>
</select>
/ <select id="select12" name="mes1">
<option></option>
<%
d=1
while d<13
Response.Write ("<OPTION ")
if mn <> "" then
if cint (Request.Form("mes"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
if d<10 then
Response.Write ("0")
end if
Response.Write (d & "'>" )
if d<10 then
Response.Write ( "0" & d & "</OPTION>")
else Response.Write (d & "</OPTION>")
end if
d=d+1
wend
%>
</select>
/ <select id="select13" name="ano1">
<option></option>
<%
d=year(date)
while d>1900
Response.Write ("<OPTION ")
if an <> "" then
if cint (Request.Form("ano"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
Response.Write (d & "'>" & d & "</OPTION>")
d=d-1
wend
%>
</select>
</td>
<td width="18%">
<select id="select11" name="dia2">
<option></option>
<%
d=1
while d<32
Response.Write ("<OPTION ")
if dn <> "" then
if cint (Request.Form("dia"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
if d<10 then
Response.Write ("0")
end if
Response.Write (d & "'>" )
if d<10 then
Response.Write ( "0" & d & "</OPTION>")
else Response.Write (d & "</OPTION>")
end if
d=d+1
wend
%>
</select>
/ <select id="select12" name="mes2">
<option></option>
<%
d=1
while d<13
Response.Write ("<OPTION ")
if mn <> "" then
if cint (Request.Form("mes"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
if d<10 then
Response.Write ("0")
end if
Response.Write (d & "'>" )
if d<10 then
Response.Write ( "0" & d & "</OPTION>")
else Response.Write (d & "</OPTION>")
end if
d=d+1
wend
%>
</select>
/ <select id="select13" name="ano2">
<option></option>
<%
d=year(date)
while d>1900
Response.Write ("<OPTION ")
if an <> "" then
if cint (Request.Form("ano"))=d then Response.Write " selected "
end if
Response.Write (" value = '")
Response.Write (d & "'>" & d & "</OPTION>")
d=d-1
wend
%>
</select>
<%
if request("dia1") <> "" then
val = "p"
else val = "v"
end if
if request("mes1") <> "" then
val = val + ",p"
else val = val + ",v"
end if
if request("ano1") <> "" then
val = val + ",p"
else val = val + ",v"
end if
if request("dia2") <> "" then
val = val + ",p"
else val = val + ",v"
end if
if request("mes2") <> "" then
val = val + ",p"
else val = val + ",v"
end if
if request("ano2") <> "" then
val = val + ",p"
else val = val + ",v" &"<br>"
end if
pr = 0
vz = 0
mystr = split (val, ",", -1, 1)
for i = 0 to 5
'Response.Write mystr(i) & "<br>"
if mystr(i) = "p" then
pr = pr + 1
end if
next
if (pr >= 1 or pr < 6) then%>
<INPUT type="text" id=text1 name="pre" value = "inv">
<%end if%>
</td>
<td width="64%"><input type="submit" value="Submit" name="B1">
</td>
</tr>
</table>
</form>
What I'm trying to do is to make sure that or no combos are selected or all are.
The alert appears on both situations, I can't validate this right.
Any sugestions? Please?...
Thank's
Paula