Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added note about Tap 5.4 not redirecting after form validation failures

...

Storing Data Between Requests

Wiki Markup
{float:right|background=#eee|width=40%}
{since:5.4}
Note: Starting in Tapestry 5.4, the default behavior for server-side validation failures is to re-render the page within the same request (rather than emitting a redirect). This removes the need to use a persistent field to store the tracker.
{since}
{float}

As with other action requests, the result of a form submission is to send a redirect to the client which re-renders the page. The ValidationTracker must be stored persistently between requests, or all the validation information will be lost (the default ValidationTracker provided by the Form is persistent).

...

Validator

Constraint Type

Description

Example

email

Ensures that the given input is a valid e-mail address

<t:textfield value="email" validate="email" />

max

long

Enforces a maximum integer value

<t:textfield value="age" validate="max=120,min=0" />

maxLength

int

Makes sure that a string value has a maximum length

<t:textfield value="zip" validate="maxlength=7" />

min

long

Enforces a minimum integer value

<t:textfield value="age" validate="max=120,min=0" />

minLength

int

Makes sure that a string value has a minimum length

<t:textfield value="somefield" validate="minlength=1" />

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="54804c2ff40712f2-72dacd15-48624685-9655af8c-453752abdf85ae2db316034d"><ac:plain-text-body><![CDATA[

regexp

pattern

Makes sure that a string value conforms to a given pattern

<t:textfield value="letterfield" validate="regexp=^[A-Za-z]+$" />

]]></ac:plain-text-body></ac:structured-macro>

required

Makes sure that a string value is not null and not the empty string

<t:textfield value="name" validate="required" />

...