Re: javascript and forms

by "Cyanide _7" <leo7278(at)hotmail.com>

 Date:  Tue, 18 Jan 2000 04:59:29 CST
 To:  jrstanford(at)home.com
 Cc:  hwg-languages(at)hwg.org
  todo: View Thread, Original
sorry, not sure about your syntax from the event handler in the FORM tag, 
but i recommend using *this* to reference the form object when sending to 
the function:

<form name="testform" action="mailto:jrstanford(at)home.com"
method="post" onSubmit="return checkForm(this);">

- Cyanide_7

>-------------------------------------------
>From: "Jim Stanford" <jrstanford(at)home.com>
>To: "hwg-languages" <hwg-languages(at)hwg.org>
>Subject: javascript and forms
>Date: Tue, 18 Jan 2000 03:56:00 -0600
>
>I've been having a terrible time trying to make sense of creating a form
>using input validation.  Below is a sample of the code (pardon the mess, I
>could not get it to come over formatted).
>
>I am sure the problem has to do with my not understanding how the DOM 
>works,
>but nothing I have read seems to be truly clear on this.  Any help is
>appreciated.
>
>Jim Stanford
>
>
>
><html>
>  <head>
>   <title>
>    Form Testing Page
>   </title>
><script language="javascript" type="text/javascript">
>
><!-- Hide script from older browsers
>
>function checkForm(testform) {
>     if (document.testform.name.value ="") {
>         alert ("You must enter your name in the required field.")
>         tmp.focus()
>         tmp.select()
>     }
>}
>  //  end hiding from older browsers -->
>
></script>
>
></head>
><body leftmargin="50">
>
><form name="testform" action="mailto:jrstanford(at)home.com" method="post"
>onSubmit="checkForm(testform)">
>
><table cellpadding=2>
>     <tr>
>         <td></td>
>         <td><font type="sans serif" size="5"><b>FORM 
>TESTING</b></font></td>
>     </tr>
>     <tr>
>         <td align="right">Name</td>
>         <td><input type="text" size="40" name="name" value="">&nbsp; 
>*</td>
>     </tr>
>     <tr>
>         <td></td>
>         <td><input type="submit" value="Submit">&nbsp;<input
>type=reset></td>
>     </tr>
></table>
>
></form>
></body>
></html>
>
>
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA