Ade Olumide wrote:

> [snip]
> I wish to validate the user input in these dynamic
> form elements. JSP scriplet expressions do not
> evaluate within my Javascript functions.
>
> How can I use Javascript to validate these form
> elements, or am I missing something here? Can I
> execute my JS function on the server by
> 'out.print'ling the jscrpt?
>
> I'll  appreciate any help I can get. Thank you.
>

First thing to remember -- JSP scriptlets execute as the page is being
created, while JavaScript functions execute as the user is filling out
the form.  The only thing you can do in your JSP page (scriptlets or not
does not matter) is generate the correct source code for the validation
function, based on the values you retrieve from the database.

Whenever I've needed to generate a customized JavaScript function like
this with JSP 1.0, I've used a scriptlet that called  out.println() to
write the JavaScript source code.  When JSP 1.1 based engines become
available, I would be more inclined to write a custom tag that generated
the correct JavaScript, but 1.1 support is not generally available yet.

>
> P.S.
>
> Iapologise if this has been discussed previously.

You can find out if it has been discussed by checking the mailing list
archives (http://archives.java.sun.com).

>
> -Ade Olumide-

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to