On Tue, 2004-08-03 at 23:08, Phil Snowdon wrote:
> Take this snippet from the samples. Supposedly if the price is
> less than one, then it will show a validation error. It
> doesn't.
>
> <fd:validation>
> <!-- This demonstrates form level validation -->
> <fd:javascript>
> var success = true;
> var price = widget.lookupWidget("dieselprice");
> if (price.value < 1) {
> price.setValidationError(new
> Packages.org.apache.cocoon.forms.validation.ValidationError("It
> can not be that low!", false));
> success = false;
> }
>
> // Must return true/false
> return success;
> </fd:javascript>
> </fd:validation>
Where do you place that <fd:validation> element, thus as child of what
other element?
IIRC in the Cocoon 2.1.5 release widget validators belonging to
container widgets (such as a repeater or the form itself) are only
executed if all children are validated successfully. In current SVN they
are however always executed.
>
> even simpler
>
> <fd:validation>
> <fd:javascript>
> return false;
> </fd:javascript>
> </fd:validation>
Note that you shouldn't do this, a validator returning false should
always set a validation error somewhere.
>
> Which should always generate a validation error doesn't seems to
> either.
>
> Is this a known issue? There's a comment in the Form.js code
> // FIXME: Remove check for removed syntax later.
> if (this.validator != undefined) {
> throw "Forms do not support custom javascript validators
> anymore. Declare your validators in the form model file.";
> }
>
> Does this mean that we can't use javascript validadtors anymore.
> What does it mean by declaring your validators in the form model
> file?
No no, this has nothing to do with the validators in the form model
file.
--
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]