Question

i have two dropdownchoice,After selecting value from first dropdownchoice i need to
select list of related values from database table and add this list into second
dropdownchoice. Here is my sample code for reference.
Give me any hint or reference.

 HTML:
 <select wicket:id="DDCStartDate" style=" width : 98px;"></select>
 <select wicket:id="DDCEndDate" style=" width : 98px;">.

Java code:

  final DropDownChoice DDCStartDate=new DropDownChoice("DDCStartDate",new    
         PropertyModel(collectionReportModel, "DDCStartDate"),lst);
  add(DDCStartDate);
  DDCStartDate.setOutputMarkupId(true);

  final DropDownChoice DDCEndDate=new DropDownChoice("DDCEndDate",);
  add(DDCEndDate);
  DDCEndDate.setOutputMarkupId(true);

POJO code:

     private Date DDCStartDate;
private Date DDCEndDate;
    public Date getDDCStartDate() 
{
    return DDCStartDate;
}
public void setDDCStartDate(Date dDCStartDate) 
{
    DDCStartDate = dDCStartDate;
}


public Date getDDCEndDate() {
    return DDCEndDate;
}
public void setDDCEndDate(Date dDCEndDate) {
    DDCEndDate = dDCEndDate;
}
Was it helpful?

Solution

You can do this using an AJAX callback. Check the "Drop Down Choice Example" on Wicket Examples.

http://www.wicket-library.com/wicket-examples/ajax/

This is the important file that shows you how to do this using the correct models.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top