final ProvincesDropDownChoice province = new ProvincesDropDownChoice("province", new PropertyModel(this.personne, "province"));
province.setLabel(new Model("Province"));
this.add(province);
this.add(new PaysDropDownChoice("pays", new PropertyModel(this.personne, "pays")){
private static final long serialVersionUID = -2426618314309535060L;
@Override
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
@Override
protected void onSelectionChanged(final Object newSelection) {
final String pays = (String) newSelection;
if(pays == "Canada"){
province.clearInput();
province.setRequired(true);
province.setCanada();
province.setEnabled(true);
}
else if(pays == "Etats-Unis"){
province.clearInput();
province.setRequired(true);
province.setUSA();
province.setEnabled(true);
}
else{
province.clearInput();
province.setEnabled(false);
province.setRequired(false);
}
}
}
.setLabel(new Model("Pays")).setRequired(true));
this.add(new RequiredTextField("codePostal", new PropertyModel(this.personne, "codePostal")).setLabel(new Model("Code postal")));
this.add(new RequiredTextField("telephone", new PropertyModel(this.personne, "telephone"), Telephone.class)
{
/**
*
*/
private static final long serialVersionUID = -1622892079642695231L;
@Override
public IConverter getConverter()
{
return new MaskConverter("###-###-####", Telephone.class);
}
}.setLabel(new Model("Telephone")));
this.add(new SexeDropDownChoice("sexe", new PropertyModel(this.personne, "sexe")).setLabel(new Model("Sexe")).setRequired(true));
this.add(new AnneesDropDownChoice("annees", new PropertyModel(this.dateNaissance, "annee")).setLabel(new Model("Annees")).setRequired(true));
this.add(new MoisDropDownChoice("mois", new PropertyModel(this.dateNaissance, "mois")).setLabel(new Model("Mois")).setRequired(true));
this.add(new JoursDropDownChoice("jours", new PropertyModel(this.dateNaissance, "jour")).setLabel(new Model("Jours")).setRequired(true));
final RequiredTextField courriel = new RequiredTextField("courriel", new PropertyModel(this.personne, "courriel"));
courriel.setLabel(new Model("Courriel")).setRequired(true);
courriel.add(EmailAddressPatternValidator.getInstance());
this.add(courriel);
final PaysDropDownChoice nationalite = new PaysDropDownChoice("nationalite", new PropertyModel(this.personne, "nationalite"));
nationalite.setLabel(new Model("Nationalite"));
this.add(nationalite);
this.add(new Button("enregistrer")
{