/** * Adds a mandatory and a read-only text field to the provided form. * * @param formItemsFactory * @param form */ private void addTextFields(final FormItemContainer form) { // Mandatory text field final TextElement textField = uifactory.addTextElement("textField", "guidemo.form.text", 256, "", form); textField.setMandatory(true); textField.setNotEmptyCheck("guidemo.form.error.notempty"); textField.setExampleKey("advanced_form.text_field.example", null); // Read-only text field final TextElement readOnly = uifactory.addTextElement("readOnly", "guidemo.form.readonly", 256, "forever", form); readOnly.setEnabled(false); }
/** * org.olat.presentation.framework.control.Controller, * org.olat.presentation.framework.UserRequest) */ @Override protected void initForm( final FormItemContainer formLayout, final Controller listener, final UserRequest ureq) { emailOrUsername = uifactory.addTextElement("emailOrUsername", "email.or.username", -1, null, formLayout); emailOrUsername.setMandatory(true); emailOrUsername.setNotEmptyCheck("email.or.username.maynotbeempty"); final FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator()); this.flc.add(buttonLayout); uifactory.addFormSubmitButton("submit", buttonLayout); uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl()); }