Class JavaScriptValidator

  extended by org.apache.cocoon.woody.validation.impl.JavaScriptValidator
All Implemented Interfaces:

public class JavaScriptValidator
extends Object
implements WidgetValidator

A WidgetValidator implemented as a JavaScript snippet. This snippet must return a boolean value. If it returns false, it must have set a validation error on the validated widget or one of its children.

The JavaScript snippet has the "this" variable set to the validated widget, and, if the form is used in a flowscript, can use the flow's global values and fonctions and the cocoon object.

CVS $Id: JavaScriptValidator.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Sylvain Wallez

Constructor Summary
JavaScriptValidator(Context context, org.mozilla.javascript.Function function)
Method Summary
 boolean validate(Widget widget, FormContext context)
          Validate a widget.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public JavaScriptValidator(Context context,
                           org.mozilla.javascript.Function function)
Method Detail


public final boolean validate(Widget widget,
                              FormContext context)
Description copied from interface: WidgetValidator
Validate a widget.

Specified by:
validate in interface WidgetValidator
widget - the widget to validate
context - the form context
true if validation was successful. If not, the validator must have set a ValidationError on the widget or one of its children.

Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.