You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Russell Pitre <rp...@gmail.com> on 2011/10/27 22:32:54 UTC

AjaxFormComponentUpdatingBehavior broken after invalid submit

Wicket 1.5.1

I have a DropDownChoice with an
AjaxFormComponentUpdatingBehavior("onchange") behavior attached to it, when
a value is chosen in the dropdown the selected value is used to lookup data
via a service call and then update other textfields in the form.  This works
great until you use the dropdown after the form was submitted with
validation errors. The onUpdate event in
the AjaxFormComponentUpdatingBehavior is still called but the other form
textfields are NOT being updated on the screen. Any ideas why the model
isn't being updated? Or, maybe I am misunderstanding what's really
happening. Any Ideas what to try next?

Thanks


new AjaxFormComponentUpdatingBehavior("onchange") {

@Override
protected void onUpdate(final AjaxRequestTarget target) {
 String selectedValue = aiNumberSelection.getValue();
AgencyInterest agencyInterest;

if (!isEmpty(selectedValue) && NumberUtils.isDigits(selectedValue)) {
 agencyInterest =
agencyInterestService.findByAiNumber(new Long(selectedValue));

} else {
agencyInterest = new AgencyInterest();
}

eerBackingModel.setAgencyInterest(agencyInterest);
 form.setDefaultModelObject(eerBackingModel);

target.add(feedbackPanel);
target.add(form.get(CID_AI_NAME));
target.add(form.get(CID_AI_NUMBER));
target.add(form.get(CID_AI_OWNER));
target.add(form.get(CID_AI_IS_STATIONARY));
target.add(form.get(CID_AI_IS_PORTABLE));
target.add(form.get(CID_AI_UTM));
target.add(form.get(CID_AI_LAT));
target.add(form.get(CID_AI_LON));
target.add(form.get(CID_AI_TITLEV_PERMIT));
target.add(form.get(CID_AI_NSR_PERMIT));
}

Re: AjaxFormComponentUpdatingBehavior broken after invalid submit

Posted by Russell Pitre <rp...@gmail.com>.
Great!  That's exactly what I needed.  Thanks.

-Russ

On Fri, Oct 28, 2011 at 2:56 AM, Martin Grigorov <mg...@apache.org>wrote:

> On Fri, Oct 28, 2011 at 7:22 AM, Hans Lesmeister 2
> <ha...@lessy-software.de> wrote:
> > Hi,
> >
> > did you already try a call to form.modelChanged() in onUpdate?
>
> form.modelChanging() is even more important because it marks the page
> as dirty and thus saves the new state of it at the end of the request
>
> >
> > -----
> > --
> > Regards,
> > Hans
> >
> > http://cantaa.de
> >
> > --
> > View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-broken-after-invalid-submit-tp3945964p3946955.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
> >
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: AjaxFormComponentUpdatingBehavior broken after invalid submit

Posted by Martin Grigorov <mg...@apache.org>.
On Fri, Oct 28, 2011 at 7:22 AM, Hans Lesmeister 2
<ha...@lessy-software.de> wrote:
> Hi,
>
> did you already try a call to form.modelChanged() in onUpdate?

form.modelChanging() is even more important because it marks the page
as dirty and thus saves the new state of it at the end of the request

>
> -----
> --
> Regards,
> Hans
>
> http://cantaa.de
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-broken-after-invalid-submit-tp3945964p3946955.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
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: AjaxFormComponentUpdatingBehavior broken after invalid submit

Posted by Hans Lesmeister 2 <ha...@lessy-software.de>.
Hi, 

did you already try a call to form.modelChanged() in onUpdate?

-----
-- 
Regards, 
Hans 

http://cantaa.de 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-broken-after-invalid-submit-tp3945964p3946955.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