java.lang.Object
org.apache.wicket.behavior.Behavior
org.apache.wicket.behavior.AbstractAjaxBehavior
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
org.apache.wicket.ajax.AjaxEventBehavior
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior
- All Implemented Interfaces:
Serializable
,IComponentAwareEventSink
,IRequestListener
,IComponentAwareHeaderContributor
,IClusterable
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A publicly reachable class that allows to introspect the submitter, e.g. to check what is the input name of the submitting component if there is such. -
Field Summary
Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR
-
Constructor Summary
ConstructorDescriptionAjaxFormSubmitBehavior
(String event) Constructor.AjaxFormSubmitBehavior
(Form<?> form, String event) Construct. -
Method Summary
Modifier and TypeMethodDescriptionprotected Form<?>
findForm()
Finds form that will be submittedboolean
final Form<?>
getForm()
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 occurredprotected void
onEvent
(AjaxRequestTarget target) Listener method for the ajax eventstatic AjaxFormSubmitBehavior
onSubmit
(String eventName, org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onSubmit) Creates anAjaxFormSubmitBehavior
based on lambda expressionsprotected void
onSubmit
(AjaxRequestTarget target) Override this method to provide special submit handling in a multi-button form.void
setDefaultProcessing
(boolean defaultProcessing) protected boolean
Controls whether or not a JSsubmit
should be triggered on the submitting form.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, onEvent, renderHead, respond
Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
findIndicatorId, getAttributes, getCallbackFunction, getCallbackFunctionBody, getCallbackScript, getCallbackScript, onBind, onMethodMismatch, 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, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onConfigure, onEvent, onException, onRemove, onTag
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.wicket.IRequestListener
rendersPage
-
Constructor Details
-
AjaxFormSubmitBehavior
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
Construct.- Parameters:
form
- form that will be submittedevent
- javascript event this behavior is attached to, like onclick
-
-
Method Details
-
getForm
- Returns:
- Form that will be submitted by this behavior
-
findForm
Finds form that will be submitted- Returns:
- form to submit or
null
if none found
-
shouldTriggerJavaScriptSubmitEvent
Controls whether or not a JSsubmit
should be triggered on the submitting form. False by default.- Returns:
- true if
submit
should be triggered, false otherwise
-
updateAjaxAttributes
Description copied from class:AbstractDefaultAjaxBehavior
Gives a chance to the specializations to modify the attributes.- Overrides:
updateAjaxAttributes
in classAjaxEventBehavior
-
onEvent
Description copied from class:AjaxEventBehavior
Listener method for the ajax event- Specified by:
onEvent
in classAjaxEventBehavior
- Parameters:
target
- the current request handler
-
onAfterSubmit
Override this method to provide special submit handling in a multi-button form. This method will be called after the form's onSubmit method.- Parameters:
target
- theAjaxRequestTarget
-
onSubmit
Override this method to provide special submit handling in a multi-button form. This method will be called before the form's onSubmit method.- Parameters:
target
- theAjaxRequestTarget
-
onError
Listener method invoked when the form has been processed and errors occurred- Parameters:
target
-
-
getDefaultProcessing
- Returns:
true
for default processing- See Also:
-
setDefaultProcessing
- Parameters:
defaultProcessing
-- See Also:
-
onSubmit
public static AjaxFormSubmitBehavior onSubmit(String eventName, org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onSubmit) Creates anAjaxFormSubmitBehavior
based on lambda expressions- Parameters:
eventName
- the event nameonSubmit
- theSerializableConsumer
which accepts theAjaxRequestTarget
- Returns:
- the
AjaxFormSubmitBehavior
-