Sorry, but I just don't get this :(
I'm totally missing the forest through the trees...so I tried to reduce the
example to the very minimum. Maybe someone can provide me an idea how to
deal with my issue?!
This is the scenario:
I have a form with two rows. Within each row there is one label and one
inputfield. The inputfield get's provided by a Panel. If I submit the form
there is only one entry within getModelObject(). The key is (of course) the
wicket:id of the input field and the value is the value of the second input
field.
How can I achieve that I get both value's??
My Java file (Test.java)
public class Test extends WebPage {
public Test() {
add( new TestForm( "TestForm" ) );
}
@SuppressWarnings("serial")
public final class TestForm extends Form<ValueMap> {
public TestForm( final String id ) {
super( id, new CompoundPropertyModel<ValueMap>( new ValueMap() )
);
setMarkupId( id );
ArrayList<String> list = new ArrayList<String>();
list.add( "Frage 1" );
list.add( "Frage 2" );
add( new ListView<String>( "ListFragen", list ) {
protected void populateItem( ListItem<String> item
) {
item.add( new Label( "Frage",
item.getModelObject() ) );
item.add( new Input_Panel( "Input" ) );
}
});
}
public final void onSubmit() {
ValueMap valueMap = getModelObject();
// within valueMap the only key is "PanelInput" with the value
of
the second input field!!
}
}
}
the corresponding markup (Test.html)
<form wicket:id="TestForm">
<table class="inhalt" width="100%" border="0">
<tr wicket:id="ListFragen">
<td colspan="2">< span wicket:id="Frage">Platzhalter< /span></td>
<td colspan="2">< span wicket:id="Input">Platzhalter< /span></td>
</tr>
<tr>
<td colspan="2"> </td>
<td colspan="2">
<input type="submit" value="Speichern">
<input type="reset" value="Abbrechen">
</td>
</tr>
</table>
</form>
My Panel (Input_Panel.java)
public class Input_Panel extends Panel {
public Input_Panel( String id ) {
super(id);
add ( new TextField<String>( "PanelInput" ) );
}
}
the corresponding markup (Input_Panel.html)
<wicket:panel>
<input wicket:id="PanelInput" type="text" size="30" maxlength="30">
</wicket:panel>
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/how-to-access-component-values-within-a-dynamic-table-tp3310939p3318845.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]