how to add values in second dropdownchoice when i select value in first dropdownchoice?

StackOverflow https://stackoverflow.com/questions/10384167

  •  04-06-2021
  •  | 
  •  

Вопрос

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;
}
Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top