Ajax validation behaviour that triggers when the selected event
is fired. The default action is to add a css class to the parent
element of the component and add any error messages in a span
directly after the component. You can change this behaviour
by overriding getErrorJavascript().
By default it uses JQuery to do the markup manipulation. You can
either skip jquery or load another library by overriding the
renderHead method.
This behaviour will also update the model object when the selected
client side event fires.
getErrorJavascript()
Returns the javascript that will manipulate the markup to
show the error message.
protected java.lang.String
getErrorSeparator()
The error separator is used to differentiate each error-message
in case a component has more than one error message
Defaults to separating using a tag.
onError(org.apache.wicket.ajax.AjaxRequestTarget target,
java.lang.RuntimeException e)
Adds the error-javascript to the response since the component
has errors.
protected void
onUpdate(org.apache.wicket.ajax.AjaxRequestTarget target)
When the component renders, onUpdate will remove the
markup containing any previous error-message.
void
renderHead(org.apache.wicket.markup.html.IHeaderResponse response)
Add the JQuery library so we can use it in the onError method
to manipulate the markup.
Methods inherited from class org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior
Adds the error-javascript to the response since the component
has errors.
Overrides:
onError in class org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior
Parameters:
target - The AjaxRequestTarget you can add components to
e - The exception if any
getErrorJavascript
protected java.lang.String getErrorJavascript()
Returns the javascript that will manipulate the markup to
show the error message. Defaults to adding a CSS-class to the
parent element (nice if you add a
or
around your
label/component)
Returns:
getErrorSeparator
protected java.lang.String getErrorSeparator()
The error separator is used to differentiate each error-message
in case a component has more than one error message
Defaults to separating using a tag.
Returns:
the markup for separating multiple error message
renderHead
public void renderHead(org.apache.wicket.markup.html.IHeaderResponse response)
Add the JQuery library so we can use it in the onError method
to manipulate the markup.
Specified by:
renderHead in interface org.apache.wicket.markup.html.IHeaderContributor
Overrides:
renderHead in class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior