- All Implemented Interfaces:
Serializable
,IComponentAwareEventSink
,IRequestListener
,IComponentAwareHeaderContributor
,IClusterable
- Direct Known Subclasses:
FilesSelectedBehavior
A behavior that updates the hosting
FormComponent
's model via Ajax when value
of the component is changed.
For TextField
and TextArea
form components this behavior uses JavaScript
input and change events, for other form component types only JavaScript
change event is used.
Note: JavaScript change event is being fired by the browser
also when the HTML form element losses the focus, i.e. an Ajax call will be made even
if there is no actual change of the form element's value!
- Since:
- 1.3
- Author:
- Janne Hietamäki (janne)
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
the change eventstatic final String
'input' and 'change' used as a fallback for all other form component types.Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic OnChangeAjaxBehavior
onChange
(org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onChange) Creates anOnChangeAjaxBehavior
based on lambda expressionsprotected void
updateAjaxAttributes
(AjaxRequestAttributes attributes) Gives a chance to the specializations to modify the attributes.Methods inherited from class org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior
checkComponent, disableFocusOnBlur, getFormComponent, getUpdateModel, onBind, onError, onEvent, onUpdate, onUpdate
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, 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
-
Field Details
-
EVENT_NAME
'input' and 'change' used as a fallback for all other form component types.- See Also:
-
EVENT_CHANGE
the change event- See Also:
-
-
Constructor Details
-
OnChangeAjaxBehavior
public OnChangeAjaxBehavior()Constructor.
-
-
Method Details
-
updateAjaxAttributes
Description copied from class:AbstractDefaultAjaxBehavior
Gives a chance to the specializations to modify the attributes.- Overrides:
updateAjaxAttributes
in classAjaxFormComponentUpdatingBehavior
-
onChange
public static OnChangeAjaxBehavior onChange(org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onChange) Creates anOnChangeAjaxBehavior
based on lambda expressions- Parameters:
onChange
- theSerializableConsumer
which accepts theAjaxRequestTarget
- Returns:
- the
OnChangeAjaxBehavior
-