You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gabor Szokoli <sz...@gmail.com> on 2007/07/30 12:45:36 UTC

Fwd: [Wicket-user] editable form

Hi,

Sorry if duplicated:

On 7/29/07, Ed _ <ed...@hotmail.com> wrote:
>
> I am trying to create an editable form - this has a drop down list. in it
>
> List ratingList = cfg.getContentRatingList();
> DropDownChoice ratingChoice = new DropDownChoice("rating", new
> PropertyModel(form, "category"), ratingList, new
> ChoiceRenderer("label", "id"));

I think what happens here is form.setCategory(ratingList.get(chosenOne)).
That's why you see generic toString output as the assigned value.
As a simple hack, you could override the toString() method of the rating class.
For a semi-decent solution, override the convertValue method of DropDownChoice.
I think what you really need is to add a Converter to ratingChoice.
(but IConverter does not extend IBehavior, so I don't know how to do
that properly)

I also don't know how these conversion tricks will work in the reverse
direction, when displaying the rating already in the model.

And in an unrelated note, you could call this component "category"
instead of "rating", and give a CompoundProertyModel to the form.
Saves a lot of typing in the long run,

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