if you were using a listview, you should have called setReuseItems(true) on it.. Maybe there exists something similar for DataView.. ListView javadoc says:

"If you nest a ListView in a Form, ALLWAYS set this property to true, as otherwise validation will not work properly. "



Lorenzo Bolzani wrote:
Hi,
I'need to display some editable values inside an HTML table.
The form contains both string and numeric values. If I submit an
invalid numeric value an error is reporter but all other values are
lost.

Using a simple form this does not happens, it happens only when we had
the "table part". I think we have done something wrong with the
dataview and the dataProvider but we cannot see what's wrong.

Following this article (we skipped the detachable part)

http://liminescence.blogspot.com/2007/12/wicket-html-table-implementation.html

I defined a very simple DataProvider

        protected List readAll() {
              return Arrays.asList(new Bean("a", 1), new Bean("b", 2));
        }

a simple dataView

        @Override
        protected void populateItem(Item item) {
           Bean bean = (Bean) item.getModelObject();
           item.setModel(new CompoundPropertyModel(bean));
           item.add(new TextField("rock"));
           item.add(new TextField("number"));
        }

and added this to a form

     final DataView personDataView = new PersonDataView("beanList",
dataProvider);
     form.add(personDataView);

This is the markup

 <table width="100%" border="0" >
   <tr><th>Rock</th>
  <th>Number</th></tr>
   <tr wicket:id="beanList">
          <td >
                       <input wicket:id="rock" type="text" size="20"
maxlength="5"/><br/>
          </td>
          <td>
                       <input wicket:id="number" type="text" size="20"
maxlength="5"/><br/>
          </td>
   </tr>
 </table>

When I type an invalid value for the "number" field the "rock" field
is reset to the default value and the input from the user is lost.

What are we doing wrong?


Thanks, bye

Lorenzo

---------------------------------------------------------------------
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