[Javascript] Validating form elements on an Edit form
KSLowers
kslowers at tampabay.rr.com
Mon Jul 7 16:08:01 CDT 2003
Thanks that worked great!
Kev
-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu]On Behalf Of podakula nagaraju
Sent: Monday, July 07, 2003 3:51 PM
To: javascript at LaTech.edu
Subject: Re: [Javascript] Validating form elements on an Edit form
try adding a "return true" statement at the end of the function. I believe
your form is never submitted without this statement.
>From: "KSLowers" <kslowers at tampabay.rr.com>
>Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
>To: <javascript at LaTech.edu>
>Subject: [Javascript] Validating form elements on an Edit form
>Date: Sat, 5 Jul 2003 21:49:52 -0400
>
>Hello
>
>I trying to learn how to re-validate modified data within an Edit form.
>Everything works well, as far as the 'asked for' data appearing as it
>should. But when I modify the data, then resubmit it nothing happens. I'm
>not sure what I'm missing and/or understanding. I have a sample of the
>code
>below, and a copy of the file if you want to see how far I've got. Can
>someone show me what to do? Kinda burn-out on this one. Thanks in advance
>for your help.
>
> Kevin
>
>==============
> <script Language="JavaScript">
> <!--
> function Form_Validator(theForm){
>
> // 1. Check if pcr number field is blank
> if (theForm.PcrNo.value == ""){
> alert("Please enter a value for the \"PcrNo\" field.");
> theForm.PcrNo.focus();
> return false;
> }
> if (theForm.PcrNo.value != "ADMIN"){
> alert("Error: A pcr number cannot contain both letters and numbers.");
> theForm.PcrNo.focus();
> return false;
> }
> if (theForm.PcrNo.value != "ETO"){
> alert("Error: A pcr number cannot contain both letters and numbers.");
> theForm.PcrNo.focus();
> return false;
> )
> if (theForm.PcrNo.value != "SICK"){
> alert("Error: A pcr number cannot contain both letters and numbers.");
> theForm.PcrNo.focus();
> return false;
> }
> }
> </script>
>
> <body>
> <FORM method=POST
>action="http://localhost/Webpages/HoursTrackingLog/HtlEditSe.asp?id=<%=iRec
o
>rdId%>" onSubmit="return Form_Validator(this)" id=form name="myform">
>
> <P><FONT face=Verdana><FONT size=2><B>PCR NO./PL</B></FONT> </FONT>
> <INPUT id=text1 style="LEFT: 60px; WIDTH: 86px; TOP: 16px; HEIGHT: 22px"
>size=12 name=PcrNo value=<%=rs("Pcr")%>></P>
>
> <P><FONT face=Verdana><FONT size=2><B>WEEKDAY</B></FONT>
> <INPUT type="text" name=DATE value=<%=rs("WeekDay")%>><A
>OnClick=ShowDate()>
> <IMG align=top border=0 height=25 id=dimg1 src="./graphics/calendar.gif"
>width=26 Title="Quick Calendar"></A>
>
> <P><FONT face=Verdana><FONT size=2><B>HOURS WORKED</B></FONT>
></FONT>
> <INPUT id=text3 style="WIDTH: 63px; HEIGHT: 22px" size=9 name=HrsWorked
>value=<%=nHrs%>></P>
> </body>
><< htlEdit.asp >>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
_________________________________________________________________
Race along with NK. The fastest Indian
http://server1.msn.co.in/sp03/tataracing/index.asp Feel the thrill!
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list