Re: user input not persisting during error validation

2008-07-21 Thread Martijn Dashorst
http://www.google.com/search?q=wicket+form+component+listview (feel lucky)

takes you to:

http://cwiki.apache.org/WICKET/listview-and-other-repeaters.html

which has an item for using form components in a listview:

http://cwiki.apache.org/WICKET/listview-and-other-repeaters.html#ListViewandotherrepeaters-Usingformcomponentsinarepeater

which says:

There are however a few provisions you have to take care of when using
a repeater in the form. Usually repeaters clear out their items at the
beginning of every request, when inside a form this is usually
undesirable because you want to preserve the old items because you
want them to keep their state as opposed to being recreated fresh.

For example, if you use ListView, you should call
ListView.setReuseItems(true) inside the form so that it preserves old
items instead of always creating new ones everytime.

Martijn


On Mon, Jul 21, 2008 at 10:43 AM, tbt <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> I'm new to wicket and i'm using a Form class with several nested Panels
> which are generated dynamically using a listview. But during error
> validation the user input values only persist in the form input fields but
> disappear from input fields which are nested inside a panel. I'm passing the
> same model so why is this happening.
>
> Sample Code
>
> Class SampleForm extends Form
> {
> .
> TextField name = new TextField("name",new
> PropertyModel(sampleModel,"name"));
> ListView listview = new ListView("listView",sampleModel.getPanelList())
> {
>
> protected void populateItem(ListItem item)
> {
> SupplierModel supplierModel = item.getModelObject();
> SupplierPanel supplierPanel = new
> SupplierPanel("supplierPanel",supplierModel );
> item.add(supplierPanel );
> }
>
> };
> 
> }
>
> SupplierPanel extends panel
> {
> SupplierPanel(String id,SupplierModel supplierModel)
> {
> ...
> add(new TextField("supplier",new PropertyModel(supplierModel,"supplier")));
> ...
>
> }
> }
>
>
> The user input is not persisting in
> add(new TextField("supplier",new PropertyModel(supplierModel,"supplier")));
> only during error validation.
>
> Please help
>
> Thanks
> --
> View this message in context: 
> http://www.nabble.com/user-input-not-persisting-during-error-validation-tp18564435p18564435.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



Re: user input not persisting during error validation

2008-07-21 Thread tbt

I'm using a submitlink to submit the form. The submit link is included inside
the form component.


public class SampleForm extends Form
{

..

SubmitLink link = new SubmitLink("addTourLink")
{
public void onSubmit()
{
setResponsePage(new ConfirmationPage());
}
};




}



tbt wrote:
> 
> Hi
> 
> I'm new to wicket and i'm using a Form class with several nested Panels
> which are generated dynamically using a listview. But during error
> validation the user input values only persist in the form input fields but
> disappear from input fields which are nested inside a panel. I'm passing
> the same model so why is this happening.
> 
> Sample Code
> 
> Class SampleForm extends Form
> {
> .
> TextField name = new TextField("name",new
> PropertyModel(sampleModel,"name"));
> ListView listview = new ListView("listView",sampleModel.getPanelList())
> {
> 
> protected void populateItem(ListItem item) 
> {
> SupplierModel supplierModel = item.getModelObject();
> SupplierPanel supplierPanel = new
> SupplierPanel("supplierPanel",supplierModel );
> item.add(supplierPanel );
> }
> 
> };
> 
> }
> 
> SupplierPanel extends panel
> {
> SupplierPanel(String id,SupplierModel supplierModel)
> {
> ...
> add(new TextField("supplier",new
> PropertyModel(supplierModel,"supplier")));
> ...
> 
> }
> }
>  
> 
> The user input is not persisting in 
> add(new TextField("supplier",new
> PropertyModel(supplierModel,"supplier")));
> only during error validation.
> 
> Please help
> 
> Thanks
> 

-- 
View this message in context: 
http://www.nabble.com/user-input-not-persisting-during-error-validation-tp18564435p18564531.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



user input not persisting during error validation

2008-07-21 Thread tbt

Hi

I'm new to wicket and i'm using a Form class with several nested Panels
which are generated dynamically using a listview. But during error
validation the user input values only persist in the form input fields but
disappear from input fields which are nested inside a panel. I'm passing the
same model so why is this happening.

Sample Code

Class SampleForm extends Form
{
.
TextField name = new TextField("name",new
PropertyModel(sampleModel,"name"));
ListView listview = new ListView("listView",sampleModel.getPanelList())
{

protected void populateItem(ListItem item) 
{
SupplierModel supplierModel = item.getModelObject();
SupplierPanel supplierPanel = new
SupplierPanel("supplierPanel",supplierModel );
item.add(supplierPanel );
}

};

}

SupplierPanel extends panel
{
SupplierPanel(String id,SupplierModel supplierModel)
{
...
add(new TextField("supplier",new PropertyModel(supplierModel,"supplier")));
...

}
}
 

The user input is not persisting in 
add(new TextField("supplier",new PropertyModel(supplierModel,"supplier")));
only during error validation.

Please help

Thanks
-- 
View this message in context: 
http://www.nabble.com/user-input-not-persisting-during-error-validation-tp18564435p18564435.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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