Hi Jonathan.

A quick "dissection" of the code you posted might clarify some of your doubts..

<html:form
* You know what this is...

onsubmit="return validateSigninForm(this)"
* This piece of code calls a dynamically generated JavaScript function that's created when the page is rendered (for this to happen you have to include <html:javascript formName="signin" /> within the JSP containing the form.) As you can see, the function name is composed of three parts: "validate", which is a default value, + "Signin", which is the name of your form and the name specified in the <html:javascript... /> tag, + "Form", which is another default value.


action="signin"
* This is just the Action name that's defined in struts-config.xml for this JSP an its associated Form bean.


method="post">
* You also know what this is :^)

The validating JavaScript functions containing the different kinds of validation for a given form are generated within the JSP code (although you can override this default behavior. See http://struts.apache.org/userGuide/struts-html.html#javascript). You should check the examples included in the Struts distribution to verify this (view source of JSP's after the browser renders'em).

On every submit the JavaScript validation routines are called for every field participating in the validation process.

Hope it helps...

Regards,

   Carlos

----- Original Message ----- From: "Jonathan M Z" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Tuesday, February 15, 2005 5:55 PM
Subject: javascript validation in struts



Hi folks,
I am trying to understand struts validation from some
example code, it has something like this:

<html:form onsubmit="return validateSigninForm(this)"
action="signin" method="post">

validateSigninForm is a javascript validation.  I
looked up in validation.xml and validator-rules,
neither this javascript function nor anything contain
the word "signin" is to be found, so how does struts
do its magic clientside validation? (the jsp itself
obviously does not have this javasription function
either.
thanks!



__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to