-----Original Message-----
From: Andrew Madu [mailto:[EMAIL PROTECTED]
Sent: 05 July 2006 12:31
To: [email protected]
Subject: Widget javascript validation problem
> <fd:validation>
> <fd:javascript>
> var success = true;
> var creditCardType = widget.lookupWidget("credit");
> var accountNumberLength = widget.lookupWidget("account_no");
>
> try {
> //Determine the credit card type and then check that the length
> //of the credit card number is correct for the credit card type.
>
> if ( creditCardType.value == "visa" &&
> accountNumberLength.value.length != 16) {
> account_no.setValidationError(new
> Packages.org.apache.cocoon.forms.validation.ValidationError("Visa card
> numbers are 16 chracters in length. Please re-enter the number.", false));
> success = false;
> }
>
> } catch (e) {
>
> }
>
> return success;
> </fd:javascript>
> </fd:validation>
I had lots of problems when I first started with validation. Thankfully you
don't seem to be doing any of those. At a glance it looks like
*account_no.setValidationError* is wrong as you declared the variable as
*accountNumberLength*. This is why I like strict type checking.
Hope that helps,
Gary
*****************************************************************
The information contained in this message may be confidential or
legally privileged and is intended for the addressee only. If you
have received this message in error or there are any problems
please notify the originator immediately. The unauthorised use,
disclosure, copying or alteration of this message is
strictly forbidden.
*****************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]