In the AjaxLink you change the model and I think your model becomes out of
sync with the formcomponent.  I think the formcomponent don't know which
value it should use. The one the end user typed or the model that has
changed. Sometimes it helps to think about when you want the model to be
update. I personally thinks one should try to update the models as little as
possibly with ajax. I think the most web users expect the data to be updated
when the form is submitted. Not on events like unblur and onchange. But you
can't always avoid it. 
One way of doing it could be to let the Ajaxlink only update the text value
in the textfield. The textfield will not be set to the model until you
submit. You would need to introduce a ordinary form submit button.
And you would need to divide the Textfields model from what the AjaxLink is
You will always need to add the textfields to you AjaxRequestTarget art.
But as I see it you got two choices here. 
1. In the Ajaxlink onclick you do your db work and set some property in the
model. The textfield is not binded to the same property. Instead you
override the Textfields onComponentTag method and
pTag.put("value",fromDBWith.toString()). ( toString is not enough you should
use a converter her, Look below )
2.  I would probably try to put the dbcall in the onComponentTag of the
textfield. The reason for this is because it would be great to have the
textfield component in charge for what it will display. If you got
cooworkes, would they look in the AjaxLink if the Textfield was not working
as expected? You would need to do some checks if the AjaxLink have been
clicked then I guess. 

Anyone else got something on this? It depends a little from case to case. I
have created a Behavior for this instead of overriding oncomponenttag.

And about
 @Override public <C> IConverter<C> getConverter(Class<C> ctype) {
    if (BigDecimal.class.isAssignableFrom(ctype)) { 
        MoneyConverter mc = new MoneyConverter(false, false); 

I suggest you change the default BigdecimalConverter on application level
instead. in wicket 1.4. you override newConverterLocator in the Application. 

View this message in context:
Sent from the Users forum mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to