org.apache.wicket.ajax.form
Class AjaxFormSubmitBehavior

java.lang.Object
  extended by org.apache.wicket.behavior.AbstractBehavior
      extended by org.apache.wicket.behavior.AbstractAjaxBehavior
          extended by org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
              extended by org.apache.wicket.ajax.AjaxEventBehavior
                  extended by org.apache.wicket.ajax.form.AjaxFormSubmitBehavior
All Implemented Interfaces:
java.io.Serializable, IBehavior, IBehaviorListener, IClusterable, IRequestListener, IHeaderContributor
Direct Known Subclasses:
AjaxFormValidatingBehavior

public abstract class AjaxFormSubmitBehavior
extends AjaxEventBehavior

Ajax event behavior that submits a form via ajax when the event it is attached to is invoked.

The form must have an id attribute in the markup or have MarkupIdSetter added.

Since:
1.2
Author:
Igor Vaynberg (ivaynberg)
See Also:
AjaxEventBehavior, Serialized Form

Field Summary
 
Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR
 
Fields inherited from interface org.apache.wicket.behavior.IBehaviorListener
INTERFACE
 
Constructor Summary
AjaxFormSubmitBehavior(Form form, java.lang.String event)
          Construct.
AjaxFormSubmitBehavior(java.lang.String event)
          Constructor.
 
Method Summary
protected  java.lang.CharSequence getEventHandler()
           
protected  Form getForm()
           
protected  java.lang.CharSequence getPreconditionScript()
           
protected abstract  void onError(AjaxRequestTarget target)
          Listener method invoked when the form has been processed and errors occurred
protected  void onEvent(AjaxRequestTarget target)
          Listener method for the ajax event
protected abstract  void onSubmit(AjaxRequestTarget target)
          Listener method that is invoked after the form has been submitted and processed without errors
 
Methods inherited from class org.apache.wicket.ajax.AjaxEventBehavior
generateCallbackScript, getEvent, onCheckEvent, onComponentTag, respond, setThrottleDelay
 
Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
findIndicatorId, getAjaxCallDecorator, getCallbackScript, getCallbackScript, getChannelName, getFailureScript, getSuccessScript, onBind, onRequest, renderHead, throttleScript
 
Methods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior
bind, getCallbackUrl, getCallbackUrl, getComponent, getImplementationId, getStatelessHint, onComponentRendered, onComponentTag, onRendered, onRenderHeadContribution, onRenderHeadInitContribution
 
Methods inherited from class org.apache.wicket.behavior.AbstractBehavior
afterRender, beforeRender, cleanup, detach, detachModel, exception, isEnabled, isTemporary, onException, rendered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AjaxFormSubmitBehavior

public AjaxFormSubmitBehavior(java.lang.String event)
Constructor. This constructor can only be used when the component this behavior is attached to is inside a form.

Parameters:
event - javascript event this behavior is attached to, like onclick

AjaxFormSubmitBehavior

public AjaxFormSubmitBehavior(Form form,
                              java.lang.String event)
Construct.

Parameters:
form - form that will be submitted
event - javascript event this behavior is attached to, like onclick
Method Detail

getForm

protected Form getForm()

getEventHandler

protected java.lang.CharSequence getEventHandler()
Overrides:
getEventHandler in class AjaxEventBehavior
Returns:
event handler

onEvent

protected void onEvent(AjaxRequestTarget target)
Description copied from class: AjaxEventBehavior
Listener method for the ajax event

Specified by:
onEvent in class AjaxEventBehavior

onSubmit

protected abstract void onSubmit(AjaxRequestTarget target)
Listener method that is invoked after the form has been submitted and processed without errors

Parameters:
target -

onError

protected abstract void onError(AjaxRequestTarget target)
Listener method invoked when the form has been processed and errors occurred

Parameters:
target -

getPreconditionScript

protected java.lang.CharSequence getPreconditionScript()
Overrides:
getPreconditionScript in class AbstractDefaultAjaxBehavior
Returns:
an optional javascript expression that determines whether the request will actually execute (in form of return XXX;);


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.