Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Output Format

The user input from all subfields is combined into one single value and used to replace the variable associated with the field. You can make a number of choices when it comes to the way how the subfield content is combined. This is done with the resultFormat and separator attributes. TheresultFormat attribute can take the following values:

ValueMeaning
plainStringThe content of all subfields is simply concatenated into one long string.
displayFormatThe content of all subfields and all labels (as displayed) is concatenated into one long string.
specialSeparatorThe content of all subfields is concatenated into one string, using the string specified with the separator attribute to separate the content of the subfields.
processedThe content is processed by Java code that you supply before replacing the variable. How to do this is described below.

Example

Here's some short example to illustrate this:

Code Block
languagexml
<field type="rule" variable="address">
  <description align="left" id="address.label"/>
  <spec id="url.address.label" txt="Connection:" layout="O:15:U : N:5:5" resultFormat="displayFormat"/>
  <validator class="com.izforge.izpack.panels.userinput.validator.RegularExpressionValidator" id="address.fail">
    <param name="pattern" value="\b.*\:(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3})\b"/>
  </validator>
</field>

or a bit more robust validation by checking whether the address is online:

Code Block
languagexml
<field type="rule" variable="address">
  <description align="left" id="address.label"/>
  <spec id="url.address.label" txt="Connection:" layout="O:15:U : N:5:5" resultFormat="displayFormat"/>
  <validator class="com.izforge.izpack.panels.userinput.validator.HostAddressValidator" id="address.fail"/>
</field>

Note:

Coming with IzPack 5.0 (introduced in 5.0.0-RC2) it is not necessary to use the <spec .. set="..."/> attribute any longer. During creating the appropriate UserInputPanel with the rule field, there will be at first filled in the the values from the assigned variables, which are parsed and divided among the single edit field of a compound rule field. If the assigned variable isn't set, the value of the 'set' attribute is used like before. This fits better the behavior of other input fields on UserInputPanel, for example of type="text"and seems to be more natural (default values are only fallbycks of missing content).