On Fri, 2004-04-30 at 04:45, Jakob Schwendner wrote:
> Thanks very much for your help there. This is exactly what I was looking
> for.
> However, the snippets you have provided don't seem to work on my
> installation.
> 
> this is what I have:
>  form.getWidget().addValidator(newValidator(function(widget) {
>   var loginWidget = widget.getWidget("login");
> 
>   if( loginWidget.getValue() == "test" ) {
>    var validationError =
>     new Packages.org.apache.cocoon.forms.validation.ValidationError("login
> taken.");
>     loginWidget.setValidationError( validationError );
> 
>    return true;
>   }
> 
>   return false;
>  }));
> 
> gets completely ignored when it comes to validation.

Ah, found a possible reason in the code: parent widgets (like form) only
get validated if their children validate successfully. This is something
we still need to sort out, this will most likely be changed.

> if I add the validator to the widget I want to validate directly, like
>  form.getWidget("login").addValidator(newValidator(function(widget) {
> 
> I get the following exception:
> 
> Original Exception: TypeError: Cannot convert null to an object.
> (resource://org/apache/cocoon/forms/flow/javascript/Form.js; line 115)

Form.js line 115 is empty. This file has last been changed on the 27th,
are you sure you're using a checkout from the 28th?

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]                          [EMAIL PROTECTED]


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

Reply via email to