mercredi 23 janvier 2019

Wicket CheckBox change visibility of other component

I have a Wicket 7 CheckBox and a hidden DateTextField. When I click on a CheckBox I want the DateTextField to be appeared and vice versa. For this reason I have added the DateTextField in a WebMarkUpContainer. If possible I dont want to use Ajax. The problem is that the WebMarkUpContainer is always hidden. In general my code is as follows:

class ResultsPanel extends Panel{

private static final class ResultsPage {

final DateTextField startDate = new DateTextField("startDate",  new DateTextFieldConfig().withLanguage("el");

final CheckBox checkBox = new CheckBox("checkBox");

final WebMarkupContainer wmc = new WebMarkupContainer("wmc");

   // bla bla bla

public Results(String id, CompoundPropertyModel propertyModel) {

            super(id, propertyModel);            
            add(checkBox);  
            wmc.setOutputMarkupPlaceholderTag(true);                     
            wmc.add(startDate);
            add(wmc.setVisible(false));  
            }

public S5ExamsResultsPanel(String id){
  super(id);   
  add(new ResultsPage("resultsPage", new CompoundPropertyModel()));
}

}




Aucun commentaire:

Enregistrer un commentaire