Have you tried:

provisionDefaultPeriod = new
DropDownChoice<TimePeriod>("provisionDefaultPeriod",
            new PropertyModel<TimePeriod>(getTypedModel(),
"provisionDefaultPeriod"),
            activeTimePeriods, renderer);

// drop down for choosing the service
commercialServiceInput.add(new AjaxFormComponentUpdatingBehavior("onchange")
{
         @Override
         protected void onUpdate(AjaxRequestTarget target) {
            provisionDefaultPeriod.setVisible(isOngoingService());
            target.add(provisionDefaultPeriod);
         }
      });

It seems much cleaner to me.

~ Thank you,
  Paul Bors

-----Original Message-----
From: Simon B [mailto:simon.bott...@gmail.com] 
Sent: Monday, May 13, 2013 2:47 PM
To: users@wicket.apache.org
Subject: form processing adding new inputs with an ajax onupdate

Hi, 

I have a form with several inputs one is a DropDownChoice with an
AjaxFormComponentUpdatingBehavior("onchange") / AFCUB("onchange") Behavior
added to it.

When the user changes the DropDownChoice, depending on the value a
previously non visible field is displayed via the AFCUB("onchange")
onUpdate(AjaxRequestTarget) method, which the user must then fill in.

Roughly the code is like this


This works fine on the browser the new input fields appear etc, but when the
form is then submitted manually with the inputs visible on the screen, their
models do not reflect the values selected by the user.

Is there something that I need to do in the onUpdate method of the
AFCUB("onchange") so the manually submitted Form of the Page reflects the
new visibility hierarchy that has been changed via the AFCUB("onchange") ?

Any help or clarification much appreciated

Cheers
Simon



--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/form-processing-adding-new-inputs
-with-an-ajax-onupdate-tp4658758.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
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

Reply via email to