Thanks for pointing that out!

On Thu, Feb 14, 2013 at 12:21 PM, Sven Meier <s...@meiers.net> wrote:

> If you use objects without overriden #equals() and #hashcode() and
> DropDownChoice you have several options:
> 1) use a custom ChoiceRenderer
> 2) override AbstractSingleSelectChoice#**getModelValue()
> 3) make sure the selected choice is the identical object contained in the
> choices list (e.g. via OpenSessionInView)
>
> https://issues.apache.org/**jira/browse/WICKET-4353<https://issues.apache.org/jira/browse/WICKET-4353>might
>  give you more information.
>
> Best regards
> Sven
>
>
> On 02/14/2013 12:01 PM, Ernesto Reinaldo Barreiro wrote:
>
>> I don't know if this has anything to do... but make sure
>> class StreetAddress implements  equals
>>
>> On Thu, Feb 14, 2013 at 11:55 AM, Lucio Crusca <lu...@sulweb.org> wrote:
>>
>>  Hello *,
>>>
>>> I have a FormComponentPanel derived class that uses a DropDownChoice
>>> with a
>>> ChoiceRenderer. The DropDownChoice id matches the field name in my model
>>> class
>>> and I use a CompountPropertyModel wrapping my model instance for the
>>> component.
>>>
>>> Code snippets:
>>>
>>> class StreetAddress
>>> ...
>>>    private String address;
>>>    @ManyToOne
>>>    private District idDistrict;
>>>
>>> ... usual getters and setters
>>>
>>>
>>> class StreetAddressFormCP extends FormComponentPanel<**StreetAddress>
>>> ...
>>>    super(myCompountPropertyModel)**);
>>>    add(new TextField("address"));
>>>    add(new DropDownChoice("idDistrict", ...));
>>>
>>> class StreetAddressForm extends Form<StreetAddress>
>>> ...
>>>    super(myCompoundPropertyModel)**;
>>>    add(new StreetAddressFormCP(**myCompoundPropertyModel));
>>>   ...
>>>
>>>
>>> All seems to work except that when I edit an address and change district
>>> in
>>> the dropdown, my onSubmit receives a model with the old value for
>>> idDistrict
>>> (but new edited value for address), so that part of the edit is lost.
>>>
>>> Isn't DropDownChoice supposed to always update the model when the user
>>> selects
>>> an item/submits the form?
>>>
>>> P.S. onSubmit overridden on a Button behaves like stated above, while
>>> onSubmit
>>> overridden on the Form behaves differently: it receives a model with a
>>> null
>>> target...
>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@wicket.**apache.org<users-unsubscr...@wicket.apache.org>
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org<users-unsubscr...@wicket.apache.org>
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>

Reply via email to