> final Integer newSubdivision = getModelObject().getSubdivision();

You're using the wrong model object, this should be:

  final Integer newSubdivision = dropdown.getModelObject();

or:

  final Integer newSubdivision = PointLocationPanel.this.subdivision

Sven

On 11/15/2012 09:13 PM, Richard W. Adams wrote:
I have a drop down choice in a FormComponentPanel, and & need to update
other parts of the panel when the user changes the selected value in the
drop down. My panel class is defined as:

PointLocationPanel extends FormComponentPanel<PointLocation>

Its constructor begins like this:

public PointLocationPanel(final String id, final IModel<PointLocation>
model,
         final String boxTitle, final MapURL mapURL) {

         super(id, model);
         setType(PointLocation.class);
         ...

This is the method where I create the drop down.

private SubdivisionDropDown createSubdivisionDropdown() {

         final SubdivisionDropDown dropdown = new SubdivisionDropDown
                 (SUBDIVISION, new PropertyModel<Integer>(this, SUBDIVISION
));
         dropdown.add(new AjaxFormComponentUpdatingBehavior(ONCHANGE) {
                 private static final long serialVersionUID =
-1285532100134482101L;
                 /*
                  * When the user picks a different subdivision, update the
segment
                  * drop down list to show segments in the newly chosen
subdivision.
                  */
                 @Override protected void onUpdate(final AjaxRequestTarget
target) {
                         final Integer newSubdivision =
getModelObject().getSubdivision();
                         smrDropdown.update(newSubdivision);
                         target.addComponent(smrDropdown);
                 }
         });
         return dropdown;
}

However, when the onUpdate() method is called & I call
getModelObject.getSubdivision(),  it returns the old value, not the newly
selected one. Can anyone see what I'm doing wrong?

Our app runs under Wicket 1.4.17.

**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**



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

Reply via email to