I'm not finished investigating this yet, but my preliminary findings 
indicate that the solution (at least in my case) is to call
dropdown.getModelObject() instead of dropdown.convertInput(). In the use 
cases I've tested so far, getModelObject() returns the correct value.




From:   Paul Bors <p...@bors.ws>
To:     <users@wicket.apache.org>
Date:   05/20/2013 11:35 AM
Subject:        RE: DropDownChoice in FormComponentPanel



Simplest way I can think of is something like:

@Override
protected void onBeforeRender() {
  if(isValid()) {
    dropDown.getFormField().setDefaultModel(getDefaultModel());
  }
  ...
  super.onBeforeRender();
}

@Override
protected void convertInput() {
  if(dropdown != null) {
    setConvertedInput(dropDown.getConvertedInput());
  }
  ...
}

But it really depends on what your FormComponentPanel is wrapping and how
you share its model among the child components.

Refer to the Wicket Users Guide section 1.8 "Creating comples form
components with FormComponentPanel":
http://wicket.apache.org/learn/books/freeguide.html

Or search the wiki pages:
https://cwiki.apache.org/WICKET/creating-custom-formcomponentpanels-to-build

-valid-objects-using-wickets-form-validation-logic.html

~ Thank you,
  Paul Bors
 

-----Original Message-----
From: Richard W. Adams [mailto:rwada...@up.com] 
Sent: Monday, May 20, 2013 8:10 AM
To: users@wicket.apache.org
Subject: DropDownChoice in FormComponentPanel

I have a FormComponentPanel with both string fields & DropDownChoice
controls. How do I get the drop downs' current selections from inside my
override of convertInput()?

I can get the string fields' values by calling the fields' convertInput()
methods, but when I call convertInput() on the drop downs, I get the
ORIGINAL value of the drop down, not the CURRENT value. I'm using Wicket
1.4.17 (version imposed by our corporate framework).

I've looked at several different Wicket references, including Wicket in
Action, Apache Wicket Cookbook & the new online free Wicket guide, but 
could
not find this issue discussed.

**

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




**

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

Reply via email to