예제 #1
0
 private void createMailInput(Form<T> form) {
   TextField<String> emailField = new TextField<String>("user.email");
   emailField.add(EmailAddressValidator.getInstance());
   emailField.add(new ValidatingFormComponentAjaxBehavior());
   form.add(emailField);
   form.add(new AjaxFormComponentFeedbackIndicator("emailValidationError", emailField));
 }
예제 #2
0
  public RegisterHtmlForm(String id, RegisterForm registerForm) {
    super(id, new CompoundPropertyModel<RegisterForm>(registerForm));

    TextField<String> email =
        new RequiredTextField<String>(
            "register.email", new PropertyModel<String>(registerForm, "email"));
    add(email);
    email.add(EmailAddressValidator.getInstance());
    email.add(StringValidator.maximumLength(SimiConstants.VALID_EMAIL_MAX_LENGTH));

    PasswordTextField password =
        new PasswordTextField(
            "register.password", new PropertyModel<String>(registerForm, "password"));
    add(password);
    password.setRequired(true);
    password.add(
        StringValidator.lengthBetween(
            SimiConstants.VALID_PASSWORD_MIX_LENGTH, SimiConstants.VALID_PASSWORD_MAX_LENGTH));

    PasswordTextField repassword =
        new PasswordTextField(
            "register.repassword", new PropertyModel<String>(registerForm, "repassword"));
    add(repassword);
    repassword.setRequired(true);
    repassword.setResetPassword(false);
    repassword.add(
        StringValidator.lengthBetween(
            SimiConstants.VALID_PASSWORD_MIX_LENGTH, SimiConstants.VALID_PASSWORD_MAX_LENGTH));

    add(new EqualPasswordInputValidator(password, repassword));

    add(new FeedbackPanel(id + ".feedback", new ContainerFeedbackMessageFilter(this)));
  }
예제 #3
0
    /** Construct. */
    public UserNameStep() {
      super(new ResourceModel("username.title"), new ResourceModel("username.summary"));

      add(new RequiredTextField<>("user.userName"));

      FormComponent<String> email =
          new RequiredTextField<String>("user.email").add(EmailAddressValidator.getInstance());
      add(email);

      TextField<String> emailRepeat = new TextField<>("emailRepeat", new Model<String>());
      add(emailRepeat);

      add(new EqualInputValidator(email, emailRepeat));
    }
예제 #4
0
  public NotificationPanel(String id) {
    super(id);
    final Notification notification = new Notification();
    final Form<Notification> form =
        new Form<Notification>("form", new CompoundPropertyModel<Notification>(notification)) {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onSubmit() {
            Notification notification = getModelObject();
            notificator.send(notification);
          }
        };
    form.add(
        new TextField<String>("to").setRequired(true).add(EmailAddressValidator.getInstance()));
    form.add(new TextField<String>("subject").setRequired(true));
    form.add(new TextArea<String>("body").setRequired(true));
    form.add(new Button("confirm"));
    add(form);
  }
예제 #5
0
  private void addFormComponents(final Form<Bean> form) {

    FormComponent<String> fc = new RequiredTextField<>("name");
    fc.add(new StringValidator(4, null));
    fc.setLabel(new ResourceModel("label.name"));

    // add AjaxPreventSubmitBehavior to the text field if it mustn't submit
    // the form when ENTER is pressed
    //		fc.add(new AjaxPreventSubmitBehavior());

    form.add(fc);
    form.add(new SimpleFormComponentLabel("name-label", fc));

    fc = new RequiredTextField<>("email");
    fc.add(EmailAddressValidator.getInstance());
    fc.setLabel(new ResourceModel("label.email"));

    form.add(fc);
    form.add(new SimpleFormComponentLabel("email-label", fc));
  }
예제 #6
0
  public PageInscription(PageParameters pp) {
    super(pp);
    setStatelessHint(true);
    final TextField<String> field =
        new TextField<String>("email", new PropertyModel<String>(this, "email"));
    field.add(EmailAddressValidator.getInstance());
    field.setRequired(true);

    StatelessForm<?> statelessForm =
        new StatelessForm("statelessform") {

          @Override
          protected void onSubmit() {
            serviceUser.log("Création user pour : " + field.getDefaultModelObject());
            info("Un email de validation vous a été envoyé.");
          }
        };
    statelessForm.add(field);
    add(statelessForm);
    add(new FeedbackPanel("feedback"));
  }
예제 #7
0
    public MemberRegistrationForm(String id, IModel<MemberData> memberModel) {
      super(id, memberModel);

      FeedbackPanel emailFeedback;
      add(emailFeedback = new FeedbackPanel("emailFeedback"));
      TextField<String> emailField = new AjaxValidationRequiredTextField("email", emailFeedback);
      emailField.add(EmailAddressValidator.getInstance());
      add(emailField);

      FeedbackPanel firstNameFeedback;
      add(firstNameFeedback = new FeedbackPanel("firstNameFeedback"));
      add(new AjaxValidationRequiredTextField("firstName", firstNameFeedback));

      FeedbackPanel lastNameFeedback;
      add(lastNameFeedback = new FeedbackPanel("lastNameFeedback"));
      add(new AjaxValidationRequiredTextField("lastName", lastNameFeedback));

      add(new TextField<String>("companyName"));

      FeedbackPanel memberIdFeedback;
      add(memberIdFeedback = new FeedbackPanel("memberIdFeedback"));
      TextField<String> memberIdField;
      add(memberIdField = new AjaxValidationRequiredTextField("memberId", memberIdFeedback));
      memberIdField.add(
          new AbstractValidator<String>() {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onValidate(IValidatable<String> validatable) {
              String memberId = validatable.getValue();
              if (memberExists(memberId)) {
                validatable.error(new ValidationError().addMessageKey("message.invalidMemberID"));
              }
            }
          });
    }
예제 #8
0
  protected void constructPanel() {

    final String chooseDtTxt = this.getLocalizer().getString("datepicker.chooseDate", mobBasePage);

    add(
        new HeaderContributor(
            new IHeaderContributor() {

              private static final long serialVersionUID = 1L;

              @Override
              public void renderHead(IHeaderResponse response) {

                // localize the jquery datepicker based on users locale setting
                // locale specific js includes for datepicker are available at
                // http://jquery-ui.googlecode.com/svn/trunk/ui/i18n/
                String localeLang = getLocale().getLanguage().toLowerCase();

                LOG.debug("Using DatePicker for locale language: {}", localeLang);

                if (PortalUtils.exists(localeLang)) {
                  response.renderJavascriptReference(
                      "scripts/jquery/i18n/jquery.ui.datepicker-" + localeLang + ".js");
                }

                response.renderJavascript(
                    "\n"
                        + "jQuery(document).ready(function($) { \n"
                        + "  $('#birthDate').datepicker( { \n"
                        + "	'buttonText' : '"
                        + chooseDtTxt
                        + "', \n"
                        + "	'changeMonth' : true, \n"
                        + "	'changeYear' : true, \n"
                        + "       'yearRange' : '-100:+0', \n"
                        + "	'showOn': 'both', \n"
                        + "	'dateFormat' : '"
                        + Constants.DATE_FORMAT_PATTERN_PICKER
                        + "', \n"
                        + "	'buttonImage': 'images/calendar.gif', \n"
                        + "	'buttonOnlyImage': true} ); \n"
                        + "});\n",
                    "datePicker");
              }
            }));

    final Form<?> form =
        new Form("standingDataForm", new CompoundPropertyModel<StandingDataPanel>(this));

    if (!PortalUtils.exists(getCustomer().getTaskId()))
      mobBasePage.getMobiliserWebSession().setShowContact(true);
    form.add(new FeedbackPanel("errorMessages"));
    form.add(
            new RequiredTextField<String>("customer.address.firstName")
                .setRequired(true)
                .add(new PatternValidator(Constants.REGEX_FIRSTNAME))
                .add(Constants.mediumStringValidator)
                .add(Constants.mediumSimpleAttributeModifier))
        .add(new ErrorIndicator());

    form.add(
        new DateTextField(
                "birthDateField",
                new PropertyModel<Date>(this, "customer.birthDateString"),
                new PatternDateConverter(Constants.DATE_FORMAT_PATTERN_PARSE, false))
            .setRequired(true)
            .add(new ErrorIndicator()));

    form.add(
        new LocalizableLookupDropDownChoice<Integer>(
                "customer.customerTypeId",
                Integer.class,
                Constants.RESOURCE_BUNDLE_CUSTOMER_TYPE,
                this,
                Boolean.FALSE,
                true)
            .setNullValid(false)
            .setRequired(true));

    form.add(
            new RequiredTextField<String>("customer.address.lastName")
                .setRequired(true)
                .add(new PatternValidator(Constants.REGEX_FIRSTNAME))
                .add(Constants.mediumStringValidator)
                .add(Constants.mediumSimpleAttributeModifier))
        .add(new ErrorIndicator());

    form.add(
        new LocalizableLookupDropDownChoice<String>(
                "customer.language",
                String.class,
                Constants.RESOURCE_BUNDLE_LANGUAGES,
                this,
                false,
                true)
            .add(new ErrorIndicator()));

    form.add(
        new LocalizableLookupDropDownChoice<String>(
                "customer.timeZone",
                String.class,
                Constants.RESOURCE_BUNDLE_TIMEZONES,
                this,
                false,
                true)
            .add(new ErrorIndicator()));

    form.add(
        new TextField<String>("customer.address.street1")
            .add(new PatternValidator(Constants.REGEX_STREET1))
            .add(Constants.mediumStringValidator)
            .add(Constants.mediumSimpleAttributeModifier)
            .add(new ErrorIndicator()));

    form.add(
        new TextField<String>("customer.address.houseNo")
            .add(StringValidator.lengthBetween(1, 20))
            .add(Constants.mediumStringValidator)
            .add(Constants.mediumSimpleAttributeModifier)
            .add(new ErrorIndicator()));
    form.add(
        new TextField<String>("customer.address.state")
            .add(new PatternValidator(Constants.REGEX_STATE))
            .add(Constants.mediumStringValidator)
            .add(Constants.mediumSimpleAttributeModifier)
            .add(new ErrorIndicator()));

    form.add(
        new LocalizableLookupDropDownChoice<String>(
                "customer.address.kvCountry", String.class, "countries", this, false, true)
            .setNullValid(false)
            .setRequired(true)
            .add(new ErrorIndicator()));

    form.add(
        new TextField<String>("customer.address.street2")
            .add(new PatternValidator(Constants.REGEX_STREET1))
            .add(Constants.mediumStringValidator)
            .add(Constants.mediumSimpleAttributeModifier)
            .add(new ErrorIndicator()));

    form.add(
        new TextField<String>("customer.address.city")
            .setRequired(false)
            .add(new PatternValidator(Constants.REGEX_CITY))
            .add(Constants.mediumStringValidator)
            .add(Constants.mediumSimpleAttributeModifier)
            .add(new ErrorIndicator()));

    form.add(
        new TextField<String>("customer.address.zip")
            .add(new PatternValidator(Constants.REGEX_ZIP))
            .add(Constants.mediumStringValidator)
            .add(Constants.mediumSimpleAttributeModifier)
            .add(new ErrorIndicator()));

    TextField<String> msisdn = new TextField<String>("customer.msisdn");
    if (!mobBasePage.getConfiguration().isMsisdnOtpConfirmed()) {
      msisdn.add(new SimpleAttributeModifier("readonly", "readonly"));
      msisdn.add(new SimpleAttributeModifier("style", "background-color: #E6E6E6;"));
    }
    form.add(
        msisdn
            .add(new PatternValidator(Constants.REGEX_PHONE_NUMBER))
            .add(Constants.mediumStringValidator)
            .add(Constants.mediumSimpleAttributeModifier)
            .add(new ErrorIndicator()));

    form.add(
        new TextField<String>("customer.address.email")
            .setRequired(true)
            .add(EmailAddressValidator.getInstance())
            .add(Constants.mediumStringValidator)
            .add(Constants.mediumSimpleAttributeModifier)
            .add(new ErrorIndicator()));

    form.add(
        new LocalizableLookupDropDownChoice<Integer>(
                "customer.kvInfoMode", Integer.class, "sendModes", this, Boolean.FALSE, true)
            .setNullValid(false)
            .setRequired(true));

    WebMarkupContainer networkProviderDiv = new WebMarkupContainer("networkProviderDiv");

    networkProviderDiv.add(
        new LocalizableLookupDropDownChoice<String>(
                "customer.networkProvider", String.class, "networkproviders", this, false, true)
            .setNullValid(false)
            .setRequired(true)
            .add(new ErrorIndicator()));

    // network provider selection to be made only for mbanking customer
    // types
    if (customer.getCustomerTypeId() != null
        && customer.getCustomerTypeId().intValue() == Constants.MBANKING_CUSTOMER_TYPE) {
      networkProviderDiv.setVisible(true);
    } else {
      networkProviderDiv.setVisible(false);
    }

    form.add(networkProviderDiv);

    form.add(
        new KeyValueDropDownChoice<Long, String>(
            "customer.feeSetId", mobBasePage.getFeeSets(getCustomer().getFeeSetId())) {
          private static final long serialVersionUID = 1L;

          @Override
          protected CharSequence getDefaultChoice(Object selected) {
            return null;
          };
        }.setNullValid(false));

    form.add(
        new KeyValueDropDownChoice<Long, String>(
            "customer.limitId", getLimitSets(getCustomer().getLimitId())) {

          private static final long serialVersionUID = 1L;
        }.setNullValid(true));

    Button feeSetConfButton =
        new Button("feeSetConf") {
          private static final long serialVersionUID = 1L;

          @Override
          public void onSubmit() {
            setResponsePage(new IndividualFeeSetConfig(getCustomer()));
          };
        }.setDefaultFormProcessing(false);
    feeSetConfButton.add(new PrivilegedBehavior(mobBasePage, Constants.PRIV_CUST_WRITE));
    form.add(feeSetConfButton);

    Button limitSetConfButton =
        new Button("limitSetConf") {
          private static final long serialVersionUID = 1L;

          @Override
          public void onSubmit() {
            setResponsePage(new IndividualLimitSetConfig(getCustomer()));
          };
        }.setDefaultFormProcessing(false);
    limitSetConfButton.add(new PrivilegedBehavior(mobBasePage, Constants.PRIV_CUST_WRITE));
    form.add(limitSetConfButton);

    form.add(
        new LocalizableLookupDropDownChoice<String>(
                "customer.securityQuestion",
                String.class,
                Constants.RESOURCE_BUNDLE_SEC_QUESTIONS,
                this,
                false,
                true)
            .setNullValid(false)
            .setRequired(true)
            .add(new ErrorIndicator()));

    form.add(
        new TextField<String>("customer.userName")
            .add(new PatternValidator(Constants.REGEX_USERNAME))
            .add(Constants.mediumStringValidator)
            .add(Constants.mediumSimpleAttributeModifier)
            .add(new ErrorIndicator()));

    form.add(
        new RequiredTextField<String>("customer.SecQuesAns")
            .add(new PatternValidator(Constants.REGEX_SECURITY_ANSWER))
            .add(Constants.mediumStringValidator)
            .add(Constants.mediumSimpleAttributeModifier)
            .add(new ErrorIndicator()));

    PrivilegedBehavior cancelReasonBehavior =
        new PrivilegedBehavior(mobBasePage, Constants.PRIV_CUST_CANCEL);
    cancelReasonBehavior.setMissingPrivilegeHidesComponent(false);
    KeyValueDropDownChoice<Integer, String> custStatus =
        new KeyValueDropDownChoice<Integer, String>(
            "customer.active", mobBasePage.getCustomerStatus());
    custStatus.add(
        new SimpleAttributeModifier(
            "onchange",
            "confirmDeactivation('"
                + getLocalizer().getString("customer.deactivate.warning", mobBasePage)
                + "')"));
    form.add(custStatus.setNullValid(false).setRequired(true).add(cancelReasonBehavior));

    WebMarkupContainer blackListReasonDiv = new WebMarkupContainer("blackListReasonDiv");
    PrivilegedBehavior blackListBehavior =
        new PrivilegedBehavior(mobBasePage, Constants.PRIV_CUST_BLACKLIST);
    blackListBehavior.setMissingPrivilegeHidesComponent(false);
    blackListReasonDiv.add(
        new LocalizableLookupDropDownChoice<Integer>(
                "customer.blackListReason",
                Integer.class,
                "blackListReasons",
                this,
                Boolean.FALSE,
                true)
            .setNullValid(false)
            .setRequired(true)
            .add(blackListBehavior));

    form.add(blackListReasonDiv);

    WebMarkupContainer cancelDivContainer = new WebMarkupContainer("cancelDivContainer");
    LocalizableLookupDropDownChoice<Integer> cancelationreason =
        new LocalizableLookupDropDownChoice<Integer>(
            "customer.cancelationReason", Integer.class, "cancellationReasons", this, false, true);
    cancelationreason.add(
        new SimpleAttributeModifier(
            "onchange",
            "confirmCancellation('"
                + getLocalizer().getString("customer.cancel.warning", mobBasePage)
                + "')"));
    cancelDivContainer.add(
        cancelationreason.setNullValid(false).setRequired(true).add(cancelReasonBehavior));
    // cancelDivContainer
    // .setVisible(getCustomer().getCustomerTypeId() ==
    // Constants.CONSUMER_IDTYPE
    // || getCustomer().getCustomerTypeId() ==
    // Constants.CUSTOMER_ROLE_MONEY_MERCHANT);
    form.add(cancelDivContainer);
    Button changenMsisdnButton =
        new Button("changeMsisdn") {
          private static final long serialVersionUID = 1L;

          @Override
          public void onSubmit() {
            Customer customer =
                mobBasePage.getCustomerByIdentification(
                    Constants.IDENT_TYPE_CUST_ID, String.valueOf(getCustomer().getId()));
            if (customer.getCancellationReasonId() != 0 || !customer.isActive()) {
              error(
                  getLocalizer()
                      .getString("customer.msisdn.change.error.customerinactive", mobBasePage));
              return;
            }
            mobBasePage.getMobiliserWebSession().setCustomerOtp(null);
            mobBasePage.getMobiliserWebSession().setCustomerOtpCount(0);
            mobBasePage.getMobiliserWebSession().setCustomerOtpLimitHit(false);
            setResponsePage(new ChangeMsisdnPage(getCustomer()));
          };
        }.setDefaultFormProcessing(false);
    changenMsisdnButton.setVisible(!mobBasePage.getConfiguration().isMsisdnOtpConfirmed());
    changenMsisdnButton.add(new PrivilegedBehavior(mobBasePage, Constants.PRIV_CUST_WRITE));

    form.add(changenMsisdnButton);
    changenMsisdnButton.setVisible(!mobBasePage.getConfiguration().isMsisdnOtpConfirmed());

    form.add(
        new Button("resetPin") {
          private static final long serialVersionUID = 1L;

          @Override
          public void onSubmit() {
            Customer customer =
                mobBasePage.getCustomerByIdentification(
                    Constants.IDENT_TYPE_MSISDN, getCustomer().getMsisdn());
            if (!PortalUtils.exists(customer)) {
              error(getLocalizer().getString("customer.reset.password.noMsisdn", mobBasePage));
              return;
            }
            setResponsePage(new ResetCredentialPage(getCustomer(), this.getWebPage(), "pin"));
          };
        }.setDefaultFormProcessing(false)
            .add(new PrivilegedBehavior(mobBasePage, Constants.PRIV_CUST_PINCALL)));

    form.add(
        new Button("resetPassword") {
          private static final long serialVersionUID = 1L;

          @Override
          public void onSubmit() {
            Address address = mobBasePage.getAddressByCustomer(getCustomer().getId());
            if (address == null || !PortalUtils.exists(address.getEmail())) {
              error(getLocalizer().getString("customer.reset.password.noEmail", mobBasePage));
              return;
            }
            setResponsePage(new ResetCredentialPage(getCustomer(), this.getWebPage(), "password"));
          };
        }.setDefaultFormProcessing(false)
            .add(new PrivilegedBehavior(mobBasePage, Constants.PRIV_CUST_PASSWORD)));

    form.add(
        new Button("update") {
          private static final long serialVersionUID = 1L;

          @Override
          public void onSubmit() {
            if (updateCustomer()) {
              LOG.info(
                  "Data updated successfully for customer["
                      + mobBasePage.getMobiliserWebSession().getCustomer().getId()
                      + "]");
              getSession().info(getLocalizer().getString("data.update.successful", mobBasePage));
              setResponsePage(new StandingDataPage(getCustomer()));
            }
          };
        }.add(new PrivilegedBehavior(mobBasePage, Constants.PRIV_CUST_WRITE))
            .setVisible(!PortalUtils.exists(getCustomer().getTaskId())));

    form.add(
        new Button("approve") {
          private static final long serialVersionUID = 1L;

          @Override
          public void onSubmit() {
            approveCustomer(true);
          };
        }.setDefaultFormProcessing(false)
            .setVisible(PortalUtils.exists(getCustomer().getTaskId())));

    form.add(
        new Button("reject") {
          private static final long serialVersionUID = 1L;

          @Override
          public void onSubmit() {
            approveCustomer(false);
          };
        }.setDefaultFormProcessing(false)
            .setVisible(PortalUtils.exists(getCustomer().getTaskId())));

    if (PortalUtils.exists(getCustomer().getTaskId())) {
      Iterator iter = form.iterator();
      Component component;
      for (int i = 0; iter.hasNext(); i++) {
        component = (Component) iter.next();

        if (component.getId().equals("approve")
            || component.getId().equals("reject")
            || component instanceof FeedbackPanel) {
          continue;
        } else if (component instanceof Button) {
          component.setVisible(false);
        } else {

          if (component.getId().equals("blackListReasonDiv")
              || component.getId().equals("cancelDivContainer")) {
            Iterator iter1 = ((WebMarkupContainer) component).iterator();
            Component comp;
            for (int j = 0; iter1.hasNext(); j++) {
              comp = (Component) iter1.next();
              comp.setEnabled(false);
              comp.add(new SimpleAttributeModifier("readonly", "readonly"));
              comp.add(new SimpleAttributeModifier("style", "background-color: #E6E6E6;"));
            }

          } else {
            component.setEnabled(false);
            component.add(new SimpleAttributeModifier("readonly", "readonly"));
            component.add(new SimpleAttributeModifier("style", "background-color: #E6E6E6;"));
          }
        }
      }
    }

    add(form);

    LOG.debug(
        "PatternDateConverter format: "
            + Constants.DATE_FORMAT_PATTERN_PARSE
            + " DatePicker format: "
            + Constants.DATE_FORMAT_PATTERN_PICKER);
  }
  private void init() {
    feedback.setOutputMarkupId(true);
    add(feedback);
    CompoundPropertyModel model = new CompoundPropertyModel(new Adherent());
    setModel(model);

    add(new RequiredTextField<String>("nom").add(new FocusOnLoadBehavior()));
    add(new RequiredTextField<String>("prenom"));
    add(
        new RequiredTextField<String>("numeroLicense", String.class)
            .add(new PatternValidator("\\d{6}")));

    // numéro de téléphone au bon format (10 caractères numériques)
    RequiredTextField<String> telephone = new RequiredTextField<String>("telephone", String.class);
    telephone.add(ExactLengthValidator.exactLength(10));
    telephone.add(new PatternValidator("\\d{10}"));
    add(telephone);

    add(new RequiredTextField<String>("mail").add(EmailAddressValidator.getInstance()));

    // Ajout de la liste des niveaux
    List<String> niveaux = new ArrayList<String>();
    for (NiveauAutonomie n : NiveauAutonomie.values()) {
      niveaux.add(n.toString());
    }
    add(new DropDownChoice("niveau", niveaux));

    // Ajout de la liste des aptitudes
    List<String> aptitudes = new ArrayList<String>();
    for (Aptitude apt : Aptitude.values()) {
      aptitudes.add(apt.name());
    }
    add(new DropDownChoice("aptitude", aptitudes));

    // Ajout de la liste des niveaux d'encadrement
    List<String> encadrement = new ArrayList<String>();
    for (Adherent.Encadrement e : Adherent.Encadrement.values()) {
      encadrement.add(e.toString());
    }
    add(new DropDownChoice("encadrement", encadrement));

    // Ajout de la checkbox pilote
    add(new CheckBox("pilote", model.bind("pilote")));

    // Ajout des roles
    List<String> roles =
        Arrays.asList(new String[] {"ADMIN", "USER", "SECRETARIAT", "DP", "ENCADRANT"});
    add(new ListMultipleChoice<String>("roles", roles));

    // Ajout du champs date du certificat medical
    DateTextField dateCMTextFiled =
        new DateTextField(
            "dateCM", new PropertyModel<Date>(model, "dateCM"), new StyleDateConverter("S-", true));
    dateCMTextFiled.setRequired(true);
    add(dateCMTextFiled);
    dateCMTextFiled.add(new DatePicker());

    Date dateDuJour = new Date();
    GregorianCalendar gc = new GregorianCalendar();
    gc.setTime(dateDuJour);
    int anneeCourante = gc.get(Calendar.YEAR);
    int nextAnnee = anneeCourante + 1;

    List<Integer> annees = new ArrayList<Integer>();
    annees.add(new Integer(anneeCourante));
    annees.add(new Integer(nextAnnee));

    DropDownChoice<Integer> listAnnee = new DropDownChoice<Integer>("anneeCotisation", annees);
    listAnnee.setRequired(true);
    add(listAnnee);

    // Ajout de la checkbox TIV
    add(new CheckBox("tiv", model.bind("tiv")));
    // commentaire
    TextArea<String> textareaInput = new TextArea<String>("commentaire");
    textareaInput.add(ExactLengthValidator.maximumLength(45));
    add(textareaInput);

    ContactPanel cuPanel = new ContactPanel("cuPanel", model);
    add(cuPanel);

    add(
        new AjaxButton("validAdherent") {
          @Override
          protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            Adherent adherent = (Adherent) form.getModelObject();
            try {

              ResaSession.get().getAdherentService().creerAdherent(adherent);

              setResponsePage(AccueilPage.class);
            } catch (TechnicalException e) {
              e.printStackTrace();
              error(e.getKey());
            }
          }
          // L'implémentation de cette méthode est nécessaire pour voir
          // les messages d'erreur dans le feedBackPanel

          @Override
          protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.addComponent(feedback);
          }
        });

    add(
        new Link("cancel") {
          @Override
          public void onClick() {
            setResponsePage(AccueilPage.class);
          }
        });
  }