org.apache.tapestry.form
Interface FormComponentContributorContext

All Superinterfaces:
ValidationMessages
All Known Implementing Classes:
FormComponentContributorContextImpl

public interface FormComponentContributorContext
extends ValidationMessages

Object that provides support to objects that implement FormComponentContributor. For the moment, at least, this is all about client-side JavaScript generation.

TODO: Having support for regular expressions might be useful (and would allow a single to be shared).

Since:
4.0
Author:
Howard Lewis Ship

Method Summary
 void addInitializationScript(IComponent target, String script)
          Adds initialization javascript code that will be executed on page/content/etc load.
 void addSubmitHandler(String handler)
          Deprecated. To be removed in 4.2 with no replacement. The new preferred way to do this is by using simple dojo.event.connect("formName", "event", object, "functionName) style connections.
 JSONObject getProfile()
          The javascript object profile being built by this context to validate/translate form values.
 void includeClasspathScript(String path)
          Includes the indicated script; the path is a path on the classpath.
 void registerForFocus(int priority)
          Registers a field for automatic focus.
 
Methods inherited from interface org.apache.tapestry.form.ValidationMessages
formatValidationMessage, getLocale
 

Method Detail

includeClasspathScript

void includeClasspathScript(String path)
Includes the indicated script; the path is a path on the classpath.


addSubmitHandler

void addSubmitHandler(String handler)
Deprecated. To be removed in 4.2 with no replacement. The new preferred way to do this is by using simple dojo.event.connect("formName", "event", object, "functionName) style connections.

Adds initialization to register a submit handler on the client side. A submit handler is a JavaScript method that accepts a single parameter, a (JavaScript) FormSubmitEvent.

Parameters:
handler - either the name of a submit listener ("myListener"), or an inline implementation of a listener function ("function(event) { ... } ").

addInitializationScript

void addInitializationScript(IComponent target,
                             String script)
Adds initialization javascript code that will be executed on page/content/etc load.

Parameters:
target - The component the script is being added for.
script - The javascript code to execute.

registerForFocus

void registerForFocus(int priority)
Registers a field for automatic focus. The goal is for the first field that is in error to get focus; failing that, the first required field; failing that, any field.

Parameters:
priority - a priority level used to determine whether the registered field becomes the focus field. Constants for this purpose are defined in ValidationConstants.
See Also:
FormBehavior.registerForFocus(IFormComponent, int)

getProfile

JSONObject getProfile()
The javascript object profile being built by this context to validate/translate form values. This is really just a delegate to FormBehavior.

Returns:
JSONObject profile.


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.