On 26.05.2004 09:33, Bruno Dumon wrote:
But this is no longer the default way for doing simple field validation. It was really just only a javascript hack. Even for your business logic validation you can probably find better ways to handle it.
No no, you can still do it that way! Just like event listeners can both be defined in the form definition and added on a widget instance, the same can be done with validators. I agree with Benoit that this is an essential feature.
See the interface Widget: it has the methods addValidator and removeValidator, which take an object implementing the WidgetValidator interface as argument. See the description of that interface on how a WidgetValidator implementation is supposed to behave.
There is still one issue, which is that widget validators on parent widgets are not executed if any of the validators on one of their child widgets fails. Once this is changed, adding a WidgetValidator on a form object would be the same as the earlier validator function, except that now the validation will be part of normal form processing cycle and that avoids a few problems. [this change is just a one line fix, and is already agreed upon, but I haven't had time for this yet]
I posted earlier an example to the list on how to implement a Java interface in javascript, or you can find that in the rhino docs also. Alternatively, in the v3 api you can do widget.validator = function() {}
Thanks for clarification, my answer was _a bit_ superficial.
Joerg
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
