|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectwicket.Component
wicket.MarkupContainer
wicket.markup.html.WebMarkupContainer
wicket.markup.html.form.Form
Base class for forms. To implement a form, subclass this class, add FormComponents (such as CheckBoxes, ListChoices or TextFields) to the form and provide an implementation of handleValidSubmit(). The handleValidSubmit() method will be called by validate() when the form passes validation. If your form has only one button, there is nothing else to do. However, if you want to have multiple buttons which submit the same form, simply put two or more button components somewhere in the hierarchy of components that are children of the form. Forms which have two or more buttons do not automatically validate themselves via validate(). Instead, they determine which Button submitted the form and call that Button's onSubmit() method. In any onSubmit() method where you want to attempt to validate the form and update models, simply call validate().
If you want to do something when validation errors occur you can override onError(), but if you do, you probably will want to call super.onError() to get the default handling to occur.
To get form components to persist their values for users via cookies, simply call setPersistent(true) on the form component.
| Nested Class Summary |
| Nested classes inherited from class wicket.Component |
Component.ComponentModelChange, Component.IVisitor, Component.VisibilityChange |
| Field Summary |
| Fields inherited from class wicket.Component |
FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4 |
| Constructor Summary | |
Form(java.lang.String id)
Constructs a form with no validation. |
|
Form(java.lang.String id,
IFeedback feedback)
|
|
Form(java.lang.String id,
IModel model,
IFeedback feedback)
|
|
| Method Summary | |
IFormValidationStrategy |
getValidationStrategy()
Gets the strategy to be used for form validation |
protected IValuePersister |
getValuePersister()
Gets the form component persistence manager; it is lazy loaded. |
protected void |
internalOnModelChanged()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
void |
loadPersistentFormComponentValues()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
protected void |
onComponentTag(ComponentTag tag)
Processes the component tag. |
protected void |
onError()
Method to override if you want to do something special when an error occurs (other than simply displaying validation errors). |
void |
onFormSubmitted()
THIS METHOD IS NOT PART OF THE WICKET API. |
protected void |
onSubmit()
Implemented by subclasses to deal with form submits. |
protected void |
onValidate()
Called when a form that has been submitted needs to be validated. |
void |
removePersistentFormComponentValues(boolean disablePersistence)
Removes already persisted data for all FormComponent childs and disable persistence for the same components. |
void |
setVersioned(boolean isVersioned)
|
protected boolean |
validate()
Validates the form and updates the models of form components. |
protected void |
visitFormComponents(FormComponent.IVisitor visitor)
Convenient and typesafe way to visit all the form components on a form |
| Methods inherited from class wicket.markup.html.WebMarkupContainer |
getMarkupType, onRender |
| Methods inherited from class wicket.MarkupContainer |
add, autoAdd, contains, findMarkupStream, get, getMarkupStream, internalAdd, internalBeginRequest, internalEndRequest, iterator, onComponentTagBody, remove, removeAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Form(java.lang.String id)
id - See Component
public Form(java.lang.String id,
IFeedback feedback)
id - See Componentfeedback - Interface to a component that can handle/display validation
errorsComponent.Component(String)
public Form(java.lang.String id,
IModel model,
IFeedback feedback)
id - See Componentmodel - See Componentfeedback - Interface to a component that can handle/display validation
errorsComponent.Component(String, IModel)| Method Detail |
public IFormValidationStrategy getValidationStrategy()
public final void loadPersistentFormComponentValues()
Retrieves FormComponent values related to the page using the persister and assign the values to the FormComponent. Thus initializing them.
public void onFormSubmitted()
onFormSubmitted in interface IFormSubmitListenervalidate()public void removePersistentFormComponentValues(boolean disablePersistence)
disablePersistence - if true, disable persistence for all FormComponents on that
page. If false, it will remain unchanged.Page.removePersistedFormData(Class, boolean)public void setVersioned(boolean isVersioned)
setVersioned in class ComponentisVersioned - True to turn on versioning for this component, false to turn
it off for this component and any children.Component.setVersioned(boolean)protected IValuePersister getValuePersister()
protected void onComponentTag(ComponentTag tag)
Component
onComponentTag in class Componenttag - Tag to modifyComponent.onComponentTag(ComponentTag)protected void onError()
protected void internalOnModelChanged()
Component
internalOnModelChanged in class ComponentComponent.internalOnModelChanged()protected void onSubmit()
protected void onValidate()
protected final boolean validate()
onSubmit(),
onError()protected void visitFormComponents(FormComponent.IVisitor visitor)
visitor - The visitor interface to call
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||