|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.tapestry.corelib.components.Form
public class Form
An HTML form, which will enclose other components to render out the various types of fields.
A Form emits many notification events. When it renders, it fires aPREPARE_FOR_RENDER notification, followed
by a PREPARE notification.
When the form is submitted, the component emits several notifications: first a PREPARE_FOR_SUBMIT, then a
PREPARE: these allow the page to update its state as necessary to prepare for the form submission, then
(after components enclosed by the form have operated), a VALIDATE_FORMevent is emitted, to allow for
cross-form validation. After that, either a SUCCESS OR FAILURE event (depending on whether the
ValidationTracker has recorded any errors). Lastly, a SUBMIT event, for any listeners that care only
about form submission, regardless of success or failure.
For all of these notifications, the event context is derived from the context parameter. This
context is encoded into the form's action URI (the parameter is not read when the form is submitted, instead the
values encoded into the form are used).
| Field Summary | |
|---|---|
static String |
FAILURE
Event type for a notification after the form has been submitted, when there are errors in the validation tracker. |
static String |
FORM_DATA
Query parameter name storing form data (the serialized commands needed to process a form submission). |
static String |
PREPARE
Invoked to let the containing component(s) prepare for the form rendering or the form submission. |
static String |
PREPARE_FOR_RENDER
Invoked before PREPARE when rendering out the form. |
static String |
PREPARE_FOR_SUBMIT
Invoked before PREPARE when the form is submitted. |
static String |
SUBMIT
Event type for a notification after the form has submitted. |
static String |
SUCCESS
Event type for a notification after the form has submitted, when there are no errors in the validation tracker. |
static String |
VALIDATE_FORM
Event type for a notification to perform validation of submitted data. |
| Constructor Summary | |
|---|---|
Form()
|
|
| Method Summary | |
|---|---|
void |
clearErrors()
Invokes ValidationTracker.clear(). |
String |
getClientId()
Forms use the same value for their name and their id attribute. |
ValidationTracker |
getDefaultTracker()
|
boolean |
getHasErrors()
Returns true if the form's ValidationTracker contains any errors. |
boolean |
isValid()
Returns true if the form's ValidationTracker does not contain any errors. |
void |
recordError(Field field,
String errorMessage)
A convienience for invoking ValidationTracker.recordError(Field, String). |
void |
recordError(String errorMessage)
A convienience for invoking ValidationTracker.recordError(String). |
void |
setDefaultTracker(ValidationTracker defaultTracker)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PREPARE_FOR_RENDER
PREPARE when rendering out the form.
public static final String PREPARE_FOR_SUBMIT
PREPARE when the form is submitted.
public static final String PREPARE
public static final String SUBMIT
public static final String VALIDATE_FORM
SUCCESS or FAILURE notification.
public static final String SUCCESS
SUBMIT event.
public static final String FAILURE
SUBMIT event.
public static final String FORM_DATA
| Constructor Detail |
|---|
public Form()
| Method Detail |
|---|
public ValidationTracker getDefaultTracker()
public void setDefaultTracker(ValidationTracker defaultTracker)
public void recordError(String errorMessage)
FormValidationControlValidationTracker.recordError(String).
recordError in interface FormValidationControl
public void recordError(Field field,
String errorMessage)
FormValidationControlValidationTracker.recordError(Field, String).
recordError in interface FormValidationControlpublic boolean getHasErrors()
FormValidationControlValidationTracker contains any errors.
getHasErrors in interface FormValidationControlpublic boolean isValid()
FormValidationControlValidationTracker does not contain any errors.
isValid in interface FormValidationControlpublic void clearErrors()
FormValidationControlValidationTracker.clear().
clearErrors in interface FormValidationControlpublic String getClientId()
getClientId in interface ClientElement
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||