Hi,
you actually need an AjaxFormSubmitBehavior to transfer all input values
to the server.
Note that AjaxFormValidatingBehavior attaches a AjaxFormSubmitBehavior
to *each* FormComponent in your form.
You could do something similar with a *single* AjaxFormSubmitBehavior
and event "focusout".
Although most projects probably use AjaxFormComponentUpdatingBehaviors
to update each FormComponent separately.
Have fun
Sven
On 18.05.2016 21:34, Lon Varscsak wrote:
@Bas, I was originally adding it to the form (which is in a parent
component), but it just wasn’t working. I’m sure I’m missing something
about the nature of parent/child components.
@Sven Can you elaborate for me a little more (still a Wicket newb). Can I
use a AjaxEventBehavior with a Form?
Thanks!
-Lon
On Wed, May 18, 2016 at 5:31 AM, Sven Meier <s...@meiers.net> wrote:
Thanks Bas!
I see, this is new in Wicket 7.x (WICKET-5196).
We could delay the check for the parental form into #onConfigure().
IMHO a better solution would be to use a bubbling event instead (e.g.
"focusout") and attaching a single listener to the form (instead of adding
a behaviors to each contained formComponent).
Sven
On 18.05.2016 13:23, Bas Gooren wrote:
Uhh, that error message is right there on the AFVB’s onBind():
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java#L102
The problem is that the check for a parent form is happening in onBind(),
so when the behavior is attached to a component.
In other words: you can only add AFVB to a component _after_ you have
added that component to a Form.
I suspect that the main reason for this is that this behavior is meant to
be used on a whole form, not a single form component.
Even when you attach it to a single component, it will always validate
_all_ components in the form.
See
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java#L117
The OP should probably be using a AjaxFormComponentUpdatingBehavior,
adding any feedback panels in onUpdate() and onError().
Met vriendelijke groet,
Kind regards,
Bas Gooren
Op 18 mei 2016 bij 11:29:26, Sven Meier (s...@meiers.net) schreef:
Hi,
I cannot find that error message in Wicket's source.
Are you using org.apache.wicket.ajax.form.AjaxFormValidatingBehavior or
some subclass or alternative?
Have fun
Sven
On 18.05.2016 02:37, Lon Varscsak wrote:
Hey guys, I may be missing something here, but if I do:
TextField textField = new TextField<String>("keyCode", new
PropertyModel<>(
order, OrderHeader.SOURCE_KEY_KEY));
textField.add(new AjaxFormValidatingBehavior("blur"));
* add(textField);*
I get an error “*AjaxFormValidatingBehavior should be bound to a Form
component or a component that is inside a form!*”
If I change it to:
TextField textField = new TextField<String>(“keyCode", new
PropertyModel<>(
order, OrderHeader.SOURCE_KEY_KEY));
* add(textField);*
textField.add(new AjaxFormValidatingBehavior("blur"));
It works. Basically the AjaxFormValidatingBehavior is expecting to
find a
form in it’s parent, but it’s parent hasn’t been assigned yet.
Is this expected behavior?
Thanks,
Lon
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org