You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brian McSweeney <br...@aurium.net> on 2003/07/02 14:54:42 UTC

Custom Validation question

Seeing as I'm doing so well today, getting my problems solved,
I thought I'd give this one a go.

I am validating some fields automatically using a ValidatorForm.
 
However, some fields I validate myself by overwriting the validate
method
as follows:
 
    public ActionErrors validate( ActionMapping mapping,
HttpServletRequest request ) {
        // this should call the validate on the automatic stuff
        ActionErrors errors = super.validate( mapping, request );
        if (errors == null) {
            errors = new ActionErrors(  );
        }
        
.my custom validation.
            
        return errors;
    }
 
Now what I am trying to do is use custom validation to validate a credit
card.
For example,
 
if ( field1=="specific_value" && field2=="other_value" ){
            validateCreditCard( field3 );
}
 
What I would like to know is, if there is a way to call the built in
server side 
validateCreditCard, or validateEmailAddress etc, methods directly from
my 
class?
 
Thanks again!
Brian