hello,
I have problem with setting Forms on DataView. I have list of Consumer
objects, each consumer has Set of attributes, I wanted to add
DropDownChoice with all attributes, when pressing Add consumer would
get new attribute to its Set, and will be saved in database. Quite
simply but not form me :(

Some ugly spike code:
   private class ConsumerDataView extends DataView {

        public ConsumerDataView(String id, ConsumerDataProvider dataProvider) {
            super(id, dataProvider);
        }

        protected void populateItem(Item item) {
            final Consumer consumer = (Consumer) item.getModelObject();
            item.setModel(new CompoundPropertyModel(consumer));
            item.add(new Label("name"));

            Form addAttributeForm = new Form("addAttributeForm") {
                            protected void onSubmit() {
                    System.out.println(getModel().getObject());
                }
                    };
            /* AttributeDescriptorProvider attributeDescriptorProvider
= new AttributeDescriptorProvider();
            DropDownChoice attributeDescriptor = new
DropDownChoice("attributeDescriptors",
                new PropertyModel(attributeDescriptorProvider,
"attributeDescriptor"),
getAttributeDAO().getAllAttributeDescriptors()); */

            DropDownChoice attributeDescriptor = new
DropDownChoice("attributeDescriptors", new Model(new
AttributeDescriptor()),
                getAttributeDAO().getAllAttributeDescriptors());

            addAttributeForm.add(attributeDescriptor);
            item.add(addAttributeForm);
        }
}

Submiting this form results in WicketMessage: No get method defined
for class: class com.test.entities.Consumer expression:
addAttributeForm
I consider that addAttributeForm doesn't belongs to object, but does
this mean that I cannot nest forms in data view?

HTML code of form:
<tr wicket:id="consumers">
                <td>
                    <form style="margin:0;" wicket:id="addAttributeForm">
                        <select wicket:id="attributeDescriptors">
                            <option>[option]</option>
                        </select>
                        <input type="submit" value="Add" />
                    </form>
                </td>
                <td>
                    <input type="checkbox" wicket:id="selected" />
                </td>
</tr>

Any idea what should be done to get it work?

Best regards,
Adr

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to