Package org.apache.wicket.ajax.form
Class OnChangeAjaxBehavior
-
- All Implemented Interfaces:
Serializable
,IComponentAwareEventSink
,IRequestListener
,IComponentAwareHeaderContributor
,IClusterable
- Direct Known Subclasses:
FilesSelectedBehavior
public abstract class OnChangeAjaxBehavior extends AjaxFormComponentUpdatingBehavior
A behavior that updates the hostingFormComponent
's model via Ajax when value of the component is changed.For
TextField
andTextArea
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:
AjaxFormComponentUpdatingBehavior.onUpdate(org.apache.wicket.ajax.AjaxRequestTarget)
,AjaxFormComponentUpdatingBehavior.onError(org.apache.wicket.ajax.AjaxRequestTarget, RuntimeException)
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
EVENT_CHANGE
the change eventstatic String
EVENT_NAME
'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
Constructors Constructor Description OnChangeAjaxBehavior()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
EVENT_NAME
public static final String EVENT_NAME
'input' and 'change' used as a fallback for all other form component types.- See Also:
- Constant Field Values
-
EVENT_CHANGE
public static final String EVENT_CHANGE
the change event- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OnChangeAjaxBehavior
public OnChangeAjaxBehavior()
Constructor.
-
-
Method Detail
-
updateAjaxAttributes
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
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
-
-