This example renders correctly, but every time I edit one of the  
values and hit the submit button, the TextFields are reverting to  
their initial value. The desired behavior is that the 'strings' list  
will be updated with whatever I enter into the text fields. What am I  
doing wrong? I am using Wicket 1.2.5.

--- ListViewForm.java ---
package com.prosc.test;

import wicket.markup.html.WebPage;
import wicket.markup.html.form.TextField;
import wicket.markup.html.form.Form;
import wicket.markup.html.list.ListView;
import wicket.markup.html.list.ListItem;
import wicket.model.Model;

import java.util.List;
import java.util.LinkedList;
import java.util.Arrays;

public class ListViewForm extends WebPage {
        String[] names = {"Jesse", "Lisa", "Sam"};
        List strings = new LinkedList( Arrays.asList(names) );

        public  ListViewForm() {
                Form form = new Form( "form" );
                form.add( new ListView("names", strings) {
                        protected void populateItem( final ListItem item ) {
                                String eachName = item.getModelObjectAsString();
                                item.add( new TextField("eachName", new 
Model(eachName) ) );
                        }
                } );
                add( form );
        }
}

--- ListViewForm.html ---
<html>
<body>
<form action="#" wicket:id="form">
        <ul>
                <li wicket:id="names">
                        <input type="text" value="Name goes here" 
wicket:id="eachName" />
                </li>
        </ul>
        <input type="submit" />
</form>
</body>
</html>



--Jesse Barnum, President, 360Works
http://www.360works.com
(770) 234-9293



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to