Hey Brian,

here's my guess: (note uncertainty :)

The javascript function required() is generated in:

org.apache.struts.taglib.html.JavascriptValidatorTag

in method doStartTag().

If you look at similar statements in other rules in the validator-rules.xml file, such as

oByte = new ByteValidations();

they often have a property jsFunctionName="ByteValidations", etc.

But required, minlength, maxlength, and a number of others do not.

In method doStartTag(), you find:

if (va.getJsFunctionName() != null && va.getJsFunctionName().length() > 0) {
functionName = va.getJsFunctionName();
} else {
functionName = va.getName();
}


and later:

results.append(" function " + functionName + " () { \n");

So it has to be generating the function:

        function required() {
                // ...
        }

and then later, in the snippet provided by the validator-rules.xml,
a function object is created with:

oRequired = new required();

I don't have client-side validation enabled on my project, but
that certainly would seem to me to be what's happening.

regards,

-jeff

On Monday, February 24, 2003, at 07:27 AM, Brian Blignaut wrote:

Hi,

I am trying to write the javascript for my own validation rules based on the javascript in the validation-rules.xml file. Can anyone tell me what the statement 'new required()' does. Where is required defined?

Any help would be greatly appreciated

Brian


--------------------------------------------------------------------- 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