use of org.apache.wicket.validation.validator.StringValidator in project wicket by apache.
the class FormPage method addFormComponents.
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));
}
Aggregations