Hi,
if you're using a Link, the browser won't send the edited values back to
your application.
Use a SubmitLink instead.
Sven
ayman elwany wrote:
Hi All ,
I'm new to Apache Wicket , I started working with it from 2 weeks and I'm
really enjoying it .but I have a little problem that I don't know what is
the problem with it .
I have a Listview contains three text fields as a table data raw with a
Link which "onClick" adds a raw to the List view ,and everything works fine
except that the text fields gets cleared whenever I Press the add Link and a
new raw added . here is my Html Mark up
*HTML:*
<tr wicket:id="employersList">
<td><input type="text" wicket:id="companyName" /></td>
<td><input type="text" wicket:id="startDate" /></td>
<td><input type="text" wicket:id="endDate" /></td>
</tr>
<tr>
<td><a wicket:id="add" href="#">add</a></td>
</tr>
*J**ava code:*
*public class CarPage extends WebPage {*
* ...... *
* .......*
* ** *private List<Employer> employerList =new ArrayList<Employer>();
public CarPage() {
*........*
* ........*
ListView employersListView=getEmployersListView();
add(employersListView);
Link addLink=new Link("add") {...@override
public void onClick() {
// TODO Auto-generated method stub
employerList.add(new Employer());
}
};
add(addLink);
}
private ListView getEmployersListView() {
// TODO Auto-generated method stub
ListView employersListView=new ListView("employersList",employerList) {
@Override
protected void populateItem(ListItem item) {
// TODO Auto-generated method stub
Employer employer=(Employer)item.getModelObject();
item.add(new TextField<String>("companyName",new
PropertyModel<String>(employer, "companyName")));
item.add(new DateTextField("startDate",
new PropertyModel<Date>(employer, "startDate"), new StyleDateConverter(
"S-", true)).add(new DatePicker()));
item.add(new DateTextField("endDate",
new PropertyModel<Date>(employer, "endDate"), new StyleDateConverter(
"S-", true)).add(new DatePicker()));
}
};
return employersListView;
}
* .......*
*.......*
}
class Employer implements Serializable{
String companyName;
Date startDate, endDate;
//Setters and getters
}
Thanks in advnce ...
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]