You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Hobbes00uk <ma...@profounddecisions.co.uk> on 2014/03/03 19:51:26 UTC

Ajax Update failing because of model

I have a text-field component that has an
AjaxFormComponentUpdatingBehavior("onchange") behaviour attached. I've hived
it off into a separate component as I'm reusing it in various places across
my app.

Everything works fine most of the time, but I've discovered that on a
particular page it doesn't perform an Ajax update, it falls back to using a
regular update and I can't work out why.

As far as I can tell it appears to be linked to the model being supplied to
the component. In other places, I'm using a fairly standard model, it just
gets and sets a field on the model object. But in this implementation, it
takes the supplied value and uses it to update another part of the system -
so the getter always returns a null. If I comment this out and replace it
with a "standard" way of using a getter and setter then everything works
fine after that.

There are no errors being reported anywhere, nothing is changed except the
backing model. Is there some reason why this might cause an Ajax update to
fail and fall back on a regular update? I'm not even sure where to look now
to try and work out what might be going wrong.

Matt Pennington

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Ajax-Update-failing-because-of-model-tp4664749.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax Update failing because of model

Posted by Matthew Pennington <ma...@profounddecisions.co.uk>.
On 03/03/2014 19:48, Sven Meier wrote:
> I can't think of a reason for this.
>
> A quickstart would help to identify the problem.
Cheers - attempting to produce a quickstart I managed to identify much 
better what was actually happening and as you might expect it's not 
really a wicket problem at all. Plus ca change.

The actual issue is that the use of my ajax component that is causing 
problems is on a form with only that component on it. (The different 
models were changing the way Wicket changed the page version numbers - 
which I had mistakenly assumed meant to no ajax update was happening). 
If I update the text field by entering some text and then moving the 
focus elsewhere, the ajax update works just fine. But if I enter the 
text and hit enter - implicit form submission takes place as per the 
defacto html standard. And because the ajax behaviour is on the control 
and not the form the page performs a full update, not an ajax update.

I assume that the best way to handle that is to put an 
AjaxFormSubmitBehaviour on the form - and that then it will handle the 
form submission with ajax as well. But if there is a better way to 
capture the implicit form submission, I'd love to hear it!

Matt Pennington.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax Update failing because of model

Posted by Sven Meier <sv...@meiers.net>.
I can't think of a reason for this.

A quickstart would help to identify the problem.

Regards
Sven

On 03/03/2014 07:51 PM, Hobbes00uk wrote:
> I have a text-field component that has an
> AjaxFormComponentUpdatingBehavior("onchange") behaviour attached. I've hived
> it off into a separate component as I'm reusing it in various places across
> my app.
>
> Everything works fine most of the time, but I've discovered that on a
> particular page it doesn't perform an Ajax update, it falls back to using a
> regular update and I can't work out why.
>
> As far as I can tell it appears to be linked to the model being supplied to
> the component. In other places, I'm using a fairly standard model, it just
> gets and sets a field on the model object. But in this implementation, it
> takes the supplied value and uses it to update another part of the system -
> so the getter always returns a null. If I comment this out and replace it
> with a "standard" way of using a getter and setter then everything works
> fine after that.
>
> There are no errors being reported anywhere, nothing is changed except the
> backing model. Is there some reason why this might cause an Ajax update to
> fail and fall back on a regular update? I'm not even sure where to look now
> to try and work out what might be going wrong.
>
> Matt Pennington
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Ajax-Update-failing-because-of-model-tp4664749.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org