first, you dont need to specify that IChoiceRenderer as it does what the
default one does

second, you are doing this: form.add(new DropDownChoice("phoneType", new
Model(),

that newModel() isnt bound to your entity, so use a constructor without that
IModel param - that way the compound property model will get used.

-igor


On 1/10/07, V. Jenks <[EMAIL PROTECTED]> wrote:


Hi all, been a long hiatus for me but I'm diving back into Wicket finally.

I'm a little rusty (was forced, against my will, to use JSF for the past
couple of months!) - and I've got a silly question...should be a snap.

I've got a DropDownChoice select list on a page I simply need to fill w/
strings.  It's not table-driven data, it's flat, and it's not represented
as
an entity/POJO...I simply need to select a single string from a list of
strings.

Here's a snippet:


..............................................................................................

                //editable entity
                PhoneNumber number = new PhoneNumber();

                //add form
                final Form form = new Form("editPhoneForm", new
CompoundPropertyModel(number));

                List<String> phoneTypeItems = new ArrayList<String>();
                phoneTypeItems.add("office");
                phoneTypeItems.add("cell");
                phoneTypeItems.add("division");

                //add dropdown select form control
                form.add(new DropDownChoice("phoneType", new Model(),
phoneTypeItems)
                {
                        public String getDisplayValue(Object object)
                        {
                                return object.toString();
                        }

                        public String getIdValue(Object object, int index)
                        {
                                return object.toString();
                        }
                }.setRequired(true));


............................................................................................

Now, when I pull up the page, it displays...all the values are there.
BUT...I get the value is null when the form is submitted...it isn't
getting
the value.

I'm using JBoss/EJB3 and I get this exception:

org.hibernate.PropertyValueException: not-null property references a null
or
transient value: com.agribeef.ed.model.PhoneNumber.phoneType

Any suggestions?  Thanks!  Glad to be back!
--
View this message in context:
http://www.nabble.com/plain-%27ol-DropDownChoice-of-strings---tf2955745.html#a8268348
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to