GitHub

User guide

Forms

Input fields, validation, conversion, uploads and submitting.

How-to guides

Directions for a specific goal.

  • Validate input and show errors Make fields required, check their values with validators, show the error messages and change their text.
  • Convert input to your types Tell a field which type its input becomes, write a converter for your own type and register it for one field or the whole application.
  • Validate with Bean Validation Check form input against the Jakarta Bean Validation annotations on your domain classes with the wicket-bean-validation module.
  • Let the user pick from a list Show a drop-down list with DropDownChoice, render objects and enums as options, and control the empty "Choose One" option.
  • Use checkboxes and radio buttons Bind a checkbox to a boolean, let the user tick several options or pick one with radio buttons, and add a "select all" checkbox.
  • Select several values Let the user select several values from a list with ListMultipleChoice, or move them between two lists with Palette.
  • Use more than one submit button Give a form several buttons that each run their own code, pick the button for the Enter key, and add a Cancel button that skips validation.
  • Nest forms Put a form inside another form, submit and validate the inner form on its own, and decide which forms take part in a submit.
  • Upload files Let users upload one or more files with FileUploadField, limit their size and number, and show upload progress.
  • Combine fields into one form component Build a FormComponentPanel that shows several inputs but converts, validates and stores them as one value.
  • Build a stateless form Use StatelessForm so a page with a form stays stateless, never expires and does not create a session until it must.

Reference

The classes, tags and settings, described.

  • Form components Every form, input, choice, upload and submit component in wicket-core and wicket-extensions, with the markup tag it needs and the type of its model.
  • Validators and converters The built-in validators, form validators and converters, with their message keys, the variables in their messages and their default texts.

Explanation

Why Wicket works the way it does.

  • How a form is processed The order in which Wicket checks, converts, validates and stores submitted input, and why a form updates all its models or none.