org.apache.wicket.ajax.form
Class AjaxFormSubmitBehavior

java.lang.Object
  extended by org.apache.wicket.behavior.Behavior
      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:
Serializable, IBehaviorListener, IComponentAwareEventSink, IRequestListener, IComponentAwareHeaderContributor, IClusterable
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, String event)
          Construct.
AjaxFormSubmitBehavior(String event)
          Constructor.
 
Method Summary
protected  Form<?> findForm()
          Finds form that will be submitted
 boolean getDefaultProcessing()
           
 Form<?> getForm()
           
protected  CharSequence getPreconditionScript()
          Deprecated. 
protected  void onAfterSubmit(AjaxRequestTarget target)
          Override this method to provide special submit handling in a multi-button form.
protected  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  void onSubmit(AjaxRequestTarget target)
          Override this method to provide special submit handling in a multi-button form.
 void setDefaultProcessing(boolean defaultProcessing)
           
protected  void updateAjaxAttributes(AjaxRequestAttributes attributes)
          Gives a chance to the specializations to modify the attributes.
 
Methods inherited from class org.apache.wicket.ajax.AjaxEventBehavior
getEvent, onCheckEvent, renderHead, respond
 
Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
findIndicatorId, getAttributes, getCallbackFunction, getCallbackFunctionBody, getCallbackScript, getCallbackScript, getChannel, getFailureScript, getSuccessScript, onBind, onRequest, postprocessConfiguration, renderAjaxAttributes, renderAjaxAttributes
 
Methods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior
afterRender, bind, getCallbackUrl, getComponent, onComponentRendered, onComponentTag, onComponentTag, onUnbind, unbind
 
Methods inherited from class org.apache.wicket.behavior.Behavior
beforeRender, canCallListenerInterface, detach, getStatelessHint, isEnabled, isTemporary, onConfigure, onEvent, onException, onRemove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AjaxFormSubmitBehavior

public AjaxFormSubmitBehavior(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,
                              String event)
Construct.

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

getForm

public final Form<?> getForm()
Returns:
Form that will be submitted by this behavior

findForm

protected Form<?> findForm()
Finds form that will be submitted

Returns:
form to submit or null if none found

updateAjaxAttributes

protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
Description copied from class: AbstractDefaultAjaxBehavior
Gives a chance to the specializations to modify the attributes.

Overrides:
updateAjaxAttributes in class AjaxEventBehavior

onEvent

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

Specified by:
onEvent in class AjaxEventBehavior
Parameters:
target - the current request handler
See Also:
AjaxEventBehavior.onEvent(org.apache.wicket.ajax.AjaxRequestTarget)

onAfterSubmit

protected void onAfterSubmit(AjaxRequestTarget target)
Override this method to provide special submit handling in a multi-button form. This method will be called after the form's onSubmit method.


onSubmit

protected void onSubmit(AjaxRequestTarget target)
Override this method to provide special submit handling in a multi-button form. This method will be called before the form's onSubmit method.


onError

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

Parameters:
target -

getPreconditionScript

@Deprecated
protected CharSequence getPreconditionScript()
Deprecated. 

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

getDefaultProcessing

public boolean getDefaultProcessing()
Returns:
true for default processing
See Also:
Button.getDefaultFormProcessing()

setDefaultProcessing

public void setDefaultProcessing(boolean defaultProcessing)
Parameters:
defaultProcessing -
See Also:
Button.setDefaultFormProcessing(boolean)


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