We need you!

Icon

The IzPack documentation needs work, and you are invited to edit it!

Skip to end of metadata
Go to start of metadata

Description

The custom input fields allows you to dynamically add or remove fields from the UserInputPanel with the click of a button.
The variable attribute defined for the custom field saves the number of rows submitted, (If two rows are submitted, variable would have value of 2).
The variable defined for the nested fields will become <variable>.<row_number> ( where the row number starts from 1 ).

Columns

<col> tags are used to add columns, they contain a field to be displayed.
Columns tags are nested within the <field type="custom" ... > tags.
Column tags may contain a validator that will validate based on all the values in the column.
The fields defined within the column tags can be defined exactly the same way as if you to define the field on its own, and can contain its own validation.
Note that the conditionid attribute for fields defined within the column tags are currently not supported.

Attributes

Attribute

Usage

RequiredDefault Value
variableDefines the variable that will hold the number of rows submitted.Yes 

minRow

Defines the minimum amount of rows that must be displayed.
This value should be less than or equal to the value in maxRow.
No1

maxRow

Defines the maximum amount of rows that must be displayed.
This value should be greater than or equal to the value in minRow.

No5

conditionid

If the condition evaluates to show this field, otherwise hide this field.NoEvaluates to true if undefined

 

Validators

Attribute

Usage

com.izforge.izpack.panels.userinput.validator.UniqueValidatorValidate that all values in a column are unique

If you are making your own column validator have a look at the source for UniqueValidator. You will realize that the values come in as a comma separated string.


Example

In the example below we define a custom field that that has three columns and atleast one row. The user may add up to three rows.
The first column will contain a combo box to select one or more creature types. It also validates that the selected creatures must be unique. (Ex. Mew cannot be chosen twice)
If creatures Mew and Pikachu were selected, it would be saved in creature.type.1 and creature.type.2 respectively.
The second column is similar to the first column except this combo box allows you to select a colour for your creature.
The third column specifies a text field for the user to submit a name for the selected creature. For each individual text field it validates that it is not empty.

  • No labels