On Thu, Aug 7, 2008 at 1:36 AM, Markus Haspl <[EMAIL PROTECTED]> wrote:
> no, there aren't any errors.
>
> but i don't understand why i have to use propertiesName.getModelObject(); in
> the onSubmit() method. Because there may be hundrets of propertiesName in
> the ListView/Form.

well, it is the way you setup the model by doing new model(value), so
the model acts as the container for the value rather then some glue
between value and some other container such as a class field. see the
models page on the wiki.

-igor


>
> Would it be better to make a Forms in a ListView? But then i need for every
> Form a submit-button. that wouldn't be so nice...
>
> thanks
>
> On Wed, Aug 6, 2008 at 7:01 PM, Igor Vaynberg <[EMAIL PROTECTED]>wrote:
>
>> if there are no errors then you are not using your models properly
>>
>>  TextField propertiesName = new TextField("name",new
>> Model(pluginProperties.getName()));
>>
>> to get a value back with a model like that you would have to call
>> propertiesName.getModelObject()
>>
>> -igor
>>
>> On Wed, Aug 6, 2008 at 8:27 AM, Markus Haspl <[EMAIL PROTECTED]> wrote:
>> > there are no valiation errors. with info() i get the old values.
>> >  info(""+property.getName()+": "+property.getValue()+" ==
>> > "+property.isDefaultProperty());
>> >
>> >
>> > On Wed, Aug 6, 2008 at 5:03 PM, Igor Vaynberg <[EMAIL PROTECTED]
>> >wrote:
>> >
>> >> add a feedbackpanel and see if there are any validation errors
>> >>
>> >> -igor
>> >>
>> >> On Wed, Aug 6, 2008 at 7:19 AM, Markus Haspl <[EMAIL PROTECTED]> wrote:
>> >> > hi,
>> >> >
>> >> > first, i'm a very newbie to wicket... I want to add a ListView in a
>> Form.
>> >> > The ListView has two Texfields and one Checkbox each row. When i
>> submit
>> >> the
>> >> > form the values are still the old ones.
>> >> >
>> >> > here the code:
>> >> >
>> >> > private class InputForm extends Form {
>> >> >
>> >> >
>> >> >
>> >> >  IModel pluginPropertiesModel;
>> >> >
>> >> >  public InputForm(String id, IPlugin plugin){
>> >> >            super(id);
>> >> >
>> >> >
>> >> >
>> >> >            final IPlugin Iplugin = plugin;
>> >> >
>> >> >            pluginPropertiesModel = new LoadableDetachableModel(){
>> >> >                public Object load()
>> >> >                {
>> >> >                    log.debug("load the Model");
>> >> >                    Iplugin.loadPluginProperties();
>> >> >                    return pluginProperties;
>> >> >                }
>> >> >            };
>> >> >
>> >> >            ListView propertiesList = new ListView("pluginRepeater",
>> >> > pluginPropertiesModel) {
>> >> >
>> >> >                @Override
>> >> >                public void populateItem(ListItem item)
>> >> >                {
>> >> >                    PluginProperties pluginProperties =
>> >> > (PluginProperties)item.getModelObject();
>> >> >                    TextField propertiesName = new TextField("name",new
>> >> > Model(pluginProperties.getName()));
>> >> >                    TextField propertiesValue = new
>> TextField("value",new
>> >> > Model(pluginProperties.getValue()));
>> >> >                    CheckBox propertiesDefault = new
>> >> > CheckBox("defaultProperty",new
>> >> Model(pluginProperties.isDefaultProperty()));
>> >> >                    item.add(propertiesName);
>> >> >                    item.add(propertiesValue);
>> >> >                    item.add(propertiesDefault);
>> >> >                }
>> >> >            };
>> >> >            propertiesList.setReuseItems(true);
>> >> >            add(propertiesList);
>> >> >
>> >> >        add(new Button("saveButton"));
>> >> >
>> >> >
>> >> >        }
>> >> >
>> >> >        public void onSubmit()
>> >> >        {
>> >> >            List<PluginProperties> pluginProperties =
>> >> > (List<PluginProperties>)pluginPropertiesModel.getObject();
>> >> >            for(PluginProperties property:pluginProperties){
>> >> >                info(""+property.getName()+": "+property.getValue()+"
>> ==
>> >> > "+property.isDefaultProperty());
>> >> >                log.debug(""+property.getName()+":
>> "+property.getValue()+"
>> >> > == "+property.isDefaultProperty());
>> >> >            }
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >        }
>> >> >    }
>> >> >
>> >> >
>> >> > thanks in advance
>> >> > markus
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>

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

Reply via email to