Yep..that is how you would do it. Something like:

<input type="text" name="SomeName" onfocus="some_javascript_routine()"
onblur="..." value="...">

I know onfocus is when the control gets keyboard focus..I thin the onblur=""
is the one where the control loses focus whether its a tab or a mouse click
into another control. Your routine it calls would validate the field at that
time.

I wrote some javascript validation routines using Regular Expressions of
javascript so that when they submit the form it validates the whole form.
You simply put <input type="hidden" name="validate"
value="required,digits_only,phone,email,etc.."> right before a field you
want validated, and the form onsubmit="" calls the one function in
javascript that iterates over every field in the form. If an error occurs it
displays an image next to the field indicating its an error, and doesn't
submit the form.


> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Randy Murrish
> Sent: Thursday, July 27, 2000 2:18 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Form Validation With JSP
>
>
> About the only way I've been able to do this is write some javascript
> that watches the textbox and handles validation on the client.
>
> Randy
>
> Philip Moschovas wrote:
> >
> > I was wondering if it is possible to do instant validation on a text box
> > within a form instead of waiting until the person submits.  I am using a
> > scanner to read a barcode string and I need to validate the
> string when it's
> > in the textbox and immediately give focus to the next text box if the
> > validation passes.  We are supposed to use JSP for this project
> and the only
> > textbox event I could possibly see that would call a JSP script
> is onchange
> > but that is only triggered if I manually change the focus from the first
> > text box.  Any idea on how to proceed?
> >
> > Thanks
> > Phil
> >
> >
> ==================================================================
> =========
> > To unsubscribe: mailto [EMAIL PROTECTED] with body:
> "signoff JSP-INTEREST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> --
> Randy Murrish                              mailto:[EMAIL PROTECTED]
> Spider Guy, ChannelPoint, Inc.              http://www.channelpoint.com
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to