/**
   * @see
   *     org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
   *     org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
   */
  @Override
  @SuppressWarnings("unused")
  protected void initForm(
      final FormItemContainer formLayout, final Controller listener, final UserRequest ureq) {
    /*
     * create a form with a title and 4 input fields to enter some persons data
     */
    setFormTitle("guidemo_flexi_form_customlayout");
    final int defaultDisplaySize = 32;
    final boolean inputMode = !personData.isReadOnly();

    firstName =
        uifactory.addTextElement(
            "firstname",
            "guidemo.flexi.form.firstname",
            256,
            personData.getFirstName(),
            formLayout);
    firstName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
    firstName.setMandatory(true);
    firstName.setEnabled(inputMode);

    lastName =
        uifactory.addTextElement(
            "lastname", "guidemo.flexi.form.lastname", 256, personData.getLastName(), formLayout);
    lastName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
    lastName.setMandatory(true);
    lastName.setEnabled(inputMode);

    institution =
        uifactory.addTextElement(
            "institution",
            "guidemo.flexi.form.institution",
            256,
            personData.getInstitution(),
            formLayout);
    institution.setEnabled(inputMode);

    if (inputMode) {
      // submit only if in input mode
      submit = new FormSubmit("submit", "submit");
      formLayout.add(submit);
    }
  }
 /**
  * @see
  *     org.olat.core.gui.components.form.flexible.impl.FormBasicController#formOK(org.olat.core.gui.UserRequest)
  */
 @Override
 @SuppressWarnings("unused")
 protected void formOK(final UserRequest ureq) {
   // this method is called if the form has validated
   // which means that all form items are filled without error
   // and all complex business rules validated also to true.
   //
   // typically the form values are now read out and persisted
   //
   // in our case, save value to data object and prepare a confirm page
   personData.setFirstName(firstName.getValue());
   personData.setLastName(lastName.getValue());
   personData.setInstitution(institution.getValue());
   personData.setReadOnly(true);
   // show the same form in readonly mode.
   confirmController = new GuiDemoFlexiForm(ureq, getWindowControl(), personData);
   confirm = createVelocityContainer("confirm");
   confirm.put("data", confirmController.getInitialComponent());
   initialPanel.pushContent(confirm);
 }