Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

#!@^@%@ Form Validation

Status
Not open for further replies.

Bastien

Programmer
May 29, 2000
1,683
CA
Hi guys,

What I have is a form that uses some javascript to do some basic checking but I can't seem to stop the Submit with the statement even if I leave the box blank:

return False;

here is the code
<script language = javascript>
<!--
function Validate(){
if (document.Report.StartDD.value ==&quot;&quot;){
alert (&quot;Please enter a number for the Day field&quot;);
document.forms.focus();
return false;
}

...same code for all boxes....
return true
}
-->
</script>

<form name = Report action = ReportStatus.asp method = post onSubmit = return &quot;Validate();&quot;>
<table><tr><td size = 25>Enter Start Date</td><td>
<input name = StartDD type = text size = 2 maxlength = 2><b>--</b>
<input name = StartMM type = text size = 2 maxlength = 2><b>--</b>
<input name = StartYY type = text size = 4 maxlength = 4>
<tr><td size = 25>Enter End Date</td><td>
<input name = EndDD type = text size = 2 maxlength = 2><b>--</b>
<input name = EndMM type = text size = 2 maxlength = 2><b>--</b>
<input name = EndYY type = text size = 4 maxlength = 4></td>
<td><input type = submit name = submit value = Submit >

can anyone spot what I am doing wrong...I an't seem to figure it out...

thanks
Bastien
 
onSubmit = &quot;return Validate();&quot;>

notice the placement of the quotations.

:)
Paul Prewett
 
You need to watch your language Bastien LOL &quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top