Author: buildbot
Date: Sat Feb 17 22:21:05 2018
New Revision: 1025531

Log:
Production update by buildbot for tapestry

Modified:
    websites/production/tapestry/content/cache/main.pageCache
    websites/production/tapestry/content/configuration.html
    websites/production/tapestry/content/forms-and-validation.html

Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/tapestry/content/configuration.html
==============================================================================
--- websites/production/tapestry/content/configuration.html (original)
+++ websites/production/tapestry/content/configuration.html Sat Feb 17 22:21:05 
2018
@@ -147,11 +147,11 @@
 
 
 <h1 id="Configuration-ConfiguringTapestry">Configuring Tapestry</h1><p>This 
page discusses all the ways in which Tapestry can be configured. Tapestry 
applications are configured almost entirely using Java, with very little XML at 
all.</p><p><strong>Contents</strong></p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1518747634495 {padding: 0px;}
-div.rbtoc1518747634495 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1518747634495 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1518906043725 {padding: 0px;}
+div.rbtoc1518906043725 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1518906043725 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1518747634495">
+/*]]>*/</style></p><div class="toc-macro rbtoc1518906043725">
 <ul class="toc-indentation"><li><a  
href="#Configuration-XMLconfiguration(web.xml)">XML configuration 
(web.xml)</a></li><li><a  
href="#Configuration-YourApplication'sModuleClass">Your Application's Module 
Class</a></li><li><a  
href="#Configuration-ConfigurationSymbolNames">Configuration Symbol 
Names</a></li><li><a  
href="#Configuration-SettingComponentParameterDefaults">Setting Component 
Parameter Defaults</a></li><li><a  
href="#Configuration-ConfiguringIgnoredPaths">Configuring Ignored 
Paths</a></li><li><a  
href="#Configuration-ConfiguringContentTypeMapping">Configuring Content Type 
Mapping</a></li><li><a  href="#Configuration-SettingExecutionModes">Setting 
Execution Modes</a></li></ul>
 </div><h2 id="Configuration-XMLconfiguration(web.xml)">XML configuration 
(web.xml)</h2><p>Tapestry runs on top of the standard Java Servlet API. To the 
servlet container, such as Tomcat, Tapestry appears as a <em>servlet 
filter</em>. This gives Tapestry great flexibility in matching URLs without 
requiring lots of XML configuration.</p><p>Although most configuration is done 
with Java, a small but necessary amount of configuration occurs inside the 
servlet deployment descriptor, WEB-INF/web.xml. Most of the configuration is 
boilerplate, nearly the same for all applications.</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>web.xml (partial)</b></div><div 
class="codeContent panelContent pdl">
 <pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;!DOCTYPE web-app
@@ -283,14 +283,28 @@ Added in 5.3.6
 <div class="aui-message aui-message-warning">
 Deprecated since 5.4 |
 Deprecated in 5.4 with no replacement. The stylesheet is now associated with 
the core JavaScriptStack
-</div><h3 
id="Configuration-tapestry.enable-minification">tapestry.enable-minification</h3>
+</div><h3 
id="Configuration-tapestry.enable-html5-support">tapestry.enable-html5-support</h3><p>
+
+
+
+</p><div class="aui-message aui-message-info">
+Added in 5.4 
+   &#160;
+</div><strong>SymbolConstants.ENABLE_HTML5_SUPPORT&#160;&#8211; </strong>If 
"true", then certain HTML5 features are invoked by built-in Tapestry 
components. Mostly this controls whether the TextField component will emit 
HTML5 "type" attributes automatically when certain validators are used. 
See&#160;<a  href="forms-and-validation.html">Forms and Validation</a> for 
details. The default is false.<h3 
id="Configuration-tapestry.enable-minification">tapestry.enable-minification</h3>
 
 
 
 <div class="aui-message aui-message-info">
 Added in 5.3.6 
    &#160;
-</div><p><strong>SymbolConstants.MINIFICATION_ENABLED</strong>&#160;&#8211; If 
"true", then resources (individually or when aggregated into stacks) will be 
minimized via the ResourceMinimizer service. If "false", then minification is 
disabled. The default is "true" in production mode, "false" 
otherwise.</p><p>Note that Tapestry's default implementation of 
ResourceMinimizer does nothing; minification is provided by add-on libraries. 
See <a  href="assets.html">Assets</a> for details.</p><h3 
id="Configuration-tapestry.encode-locale-into-path">tapestry.encode-locale-into-path</h3><p><strong>SymbolConstants.ENCODE_LOCALE_INTO_PATH</strong>&#160;&#8211;
 If "true" (the default), then the <a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/PersistentLocale.html";>PersistentLocale</a>
 will be encoded into URLs by the ComponentEventLinkEncoder service. If 
overridden to "false" this does not occur, but you should provide a 
LinkCreationListene
 r2 (registered with the LinkCreationHub) in order to add the locale as a query 
parameter (or provide some alternate means of persisting the locale between 
requests). See&#160;<a  href="localization.html">Localization</a> for more 
details on localization.</p><h3 
id="Configuration-tapestry.exception-report-page">tapestry.exception-report-page</h3><p><strong>SymbolConstants.EXCEPTION_REPORT_PAGE</strong>&#160;&#8211;
 The name of the page used to report exceptions. This defaults to 
"ExceptionReport", a page that Tapestry provides. See&#160;<a  
href="overriding-exception-reporting.html">Overriding Exception Reporting</a> 
for details.</p><h3 
id="Configuration-tapestry.exception-reports-dir">tapestry.exception-reports-dir</h3><p>
+</div><p><strong>SymbolConstants.MINIFICATION_ENABLED</strong>&#160;&#8211; If 
"true", then resources (individually or when aggregated into stacks) will be 
minimized via the ResourceMinimizer service. If "false", then minification is 
disabled. The default is "true" in production mode, "false" 
otherwise.</p><p>Note that Tapestry's default implementation of 
ResourceMinimizer does nothing; minification is provided by add-on libraries. 
See <a  href="assets.html">Assets</a> for details.</p><h3 
id="Configuration-tapestry.enable-pageloading-mask">tapestry.enable-pageloading-mask</h3>
+
+
+
+<div class="aui-message aui-message-info">
+Added in 5.4 
+   &#160;
+</div><p><strong>SymbolConstantsaENABLE_PAGELOADING_MASK</strong> &#8211; If 
true, then when a page includes any JavaScript, a <code>&lt;script&gt;</code> 
block is added to insert a pageloader mask into the page to ensure that the 
user can't interact with the page until the page is fully initialized. The 
default is true.</p><h3 
id="Configuration-tapestry.encode-locale-into-path">tapestry.encode-locale-into-path</h3><p><strong>SymbolConstants.ENCODE_LOCALE_INTO_PATH</strong>&#160;&#8211;
 If "true" (the default), then the <a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/PersistentLocale.html";>PersistentLocale</a>
 will be encoded into URLs by the ComponentEventLinkEncoder service. If 
overridden to "false" this does not occur, but you should provide a 
LinkCreationListener2 (registered with the LinkCreationHub) in order to add the 
locale as a query parameter (or provide some alternate means of persisting the 
locale between requests)
 . See&#160;<a  href="localization.html">Localization</a> for more details on 
localization.</p><h3 
id="Configuration-tapestry.exception-report-page">tapestry.exception-report-page</h3><p><strong>SymbolConstants.EXCEPTION_REPORT_PAGE</strong>&#160;&#8211;
 The name of the page used to report exceptions. This defaults to 
"ExceptionReport", a page that Tapestry provides. See&#160;<a  
href="overriding-exception-reporting.html">Overriding Exception Reporting</a> 
for details.</p><h3 
id="Configuration-tapestry.exception-reports-dir">tapestry.exception-reports-dir</h3><p>
 
 
 
@@ -382,7 +396,14 @@ Starting in 5.2, this is only used if ta
 <div class="aui-message aui-message-warning">
 Deprecated since 5.2 |
 Starting in 5.2, this is only used if tapestry.page-pool-enabled is "true". 
<em>Removed in 5.3</em>
-</div><p>The time interval that Tapestry will wait for a page instance to 
become available before deciding whether to create an entirely new page 
instance.</p><p>The default is "10 ms" (10 milliseconds; see <a  
class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/util/TimeInterval.html";>Time
 Interval Formats</a>).</p><h3 
id="Configuration-tapestry.persistence-strategy">tapestry.persistence-strategy</h3><p><strong>SymbolConstants.PERSISTENCE_STRATEGY</strong>&#160;&#8211;
 Identifies the default <a  class="external-link" 
href="http://tapestry.apache.org/persistent-page-data.html#PersistentPageData-PersistenceStrategies";>persistence
 strategy</a> for all pages that do not provide an override. The default is 
"session" (PersistenceConstants.SESSION).</p><h3 
id="Configuration-tapestry.production-mode">tapestry.production-mode</h3><p><strong>SymbolConstants.PRODUCTION_MODE</strong>&#160;&#8211;
 A flag (true or false) indicating whether the applicat
 ion is running in production or in development. The default is true, which 
means that runtime exceptions are not reported with full detail (only the root 
exception message is displayed, not the entire stack of exceptions, properties 
and other information shown in development mode).</p><h3 
id="Configuration-tapestry.restrictive-environment">tapestry.restrictive-environment</h3><p>
+</div><p>The time interval that Tapestry will wait for a page instance to 
become available before deciding whether to create an entirely new page 
instance.</p><p>The default is "10 ms" (10 milliseconds; see <a  
class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/util/TimeInterval.html";>Time
 Interval Formats</a>).</p><h3 
id="Configuration-tapestry.page-preload-mode">tapestry.page-preload-mode</h3><p>
+
+
+
+</p><div class="aui-message aui-message-info">
+Added in 5.4 
+   &#160;
+</div><strong>SymbolConstants.PRELOADER_MODE&#160;&#8211; </strong>Controls in 
what environment page preloading should occur. By default, preloading only 
occurs in production. Possible values are "ALWAYS", "DEVELOPMENT", "NEVER", or 
"PRODUCTION" (the default is PRODUCTION when in production mode, or DEVELOPMENT 
otherwise). See <a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/pageload/PreloaderMode.html";>PreloaderMode</a>.<h3
 
id="Configuration-tapestry.persistence-strategy">tapestry.persistence-strategy</h3><p><strong>SymbolConstants.PERSISTENCE_STRATEGY</strong>&#160;&#8211;
 Identifies the default <a  class="external-link" 
href="http://tapestry.apache.org/persistent-page-data.html#PersistentPageData-PersistenceStrategies";>persistence
 strategy</a> for all pages that do not provide an override. The default is 
"session" (PersistenceConstants.SESSION).</p><h3 
id="Configuration-tapestry.production-mode">tapestry.production-mode</h3>
 <p><strong>SymbolConstants.PRODUCTION_MODE</strong>&#160;&#8211; A flag (true 
or false) indicating whether the application is running in production or in 
development. The default is true, which means that runtime exceptions are not 
reported with full detail (only the root exception message is displayed, not 
the entire stack of exceptions, properties and other information shown in 
development mode).</p><h3 
id="Configuration-tapestry.restrictive-environment">tapestry.restrictive-environment</h3><p>
 
 
 

Modified: websites/production/tapestry/content/forms-and-validation.html
==============================================================================
--- websites/production/tapestry/content/forms-and-validation.html (original)
+++ websites/production/tapestry/content/forms-and-validation.html Sat Feb 17 
22:21:05 2018
@@ -120,16 +120,19 @@
 
 
 <p>&#160;</p><p>Tapestry provides support for creating and rendering forms, 
populating their fields, and validating user input. For simple cases, input 
validation is declarative, meaning you simply tell Tapestry what validations to 
apply to a given field, and it takes care of it on the server and (optionally) 
on the client as well. In addition, you can provide event handler 
methods&#160;in your page or component classes to handle more complex 
validation scenarios.</p><p>Finally, Tapestry not only makes it easy to present 
errors messages to the user, but it can also automatically highlight form 
fields when validation fails.</p><p><strong>Contents</strong></p><p><style 
type="text/css">/*<![CDATA[*/
-div.rbtoc1518405706808 {padding: 0px;}
-div.rbtoc1518405706808 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1518405706808 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1518906045481 {padding: 0px;}
+div.rbtoc1518906045481 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1518906045481 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1518405706808">
+/*]]>*/</style></p><div class="toc-macro rbtoc1518906045481">
 <ul class="toc-indentation"><li>Related Articles</li></ul>
-<ul><li><a  href="#FormsandValidation-TheFormComponent">The Form 
Component</a></li><li><a  href="#FormsandValidation-FormEvents">Form 
Events</a></li><li><a  href="#FormsandValidation-HandlingEvents">Handling 
Events</a></li><li><a  
href="#FormsandValidation-TrackingValidationErrors">Tracking Validation 
Errors</a></li><li><a  
href="#FormsandValidation-StoringDataBetweenRequests">Storing Data Between 
Requests</a></li><li><a  
href="#FormsandValidation-ConfiguringFieldsandLabels">Configuring Fields and 
Labels</a></li><li><a  
href="#FormsandValidation-CentralizingValidationwith@Validate">Centralizing 
Validation with @Validate</a></li><li><a  
href="#FormsandValidation-ServerSideValidation">Server Side 
Validation</a></li><li><a  
href="#FormsandValidation-CustomizingValidationMessages">Customizing Validation 
Messages</a>
+<ul><li><a  href="#FormsandValidation-TheFormComponent">The Form Component</a>
+<ul class="toc-indentation"><li><a  href="#FormsandValidation-FormEvents">Form 
Events</a></li><li><a  href="#FormsandValidation-HandlingEvents">Handling 
Events</a></li><li><a  
href="#FormsandValidation-TrackingValidationErrors">Tracking Validation 
Errors</a></li><li><a  
href="#FormsandValidation-StoringDataBetweenRequests">Storing Data Between 
Requests</a></li><li><a  
href="#FormsandValidation-ConfiguringFieldsandLabels">Configuring Fields and 
Labels</a></li></ul>
+</li><li><a  href="#FormsandValidation-FormValidation">Form Validation</a>
+<ul class="toc-indentation"><li><a  
href="#FormsandValidation-AvailableValidators">Available 
Validators</a></li><li><a  
href="#FormsandValidation-CentralizingValidationwith@Validate">Centralizing 
Validation with @Validate</a></li><li><a  
href="#FormsandValidation-HTML5Client-sideValidation">HTML5 Client-side 
Validation</a></li><li><a  
href="#FormsandValidation-ServerSideValidation">Server Side 
Validation</a></li><li><a  
href="#FormsandValidation-CustomizingValidationMessages">Customizing Validation 
Messages</a>
 <ul class="toc-indentation"><li><a  
href="#FormsandValidation-CustomizingValidationMessagesforBeanEditForm">Customizing
 Validation Messages for BeanEditForm</a></li></ul>
 </li><li><a  
href="#FormsandValidation-ConfiguringValidatorContraintsintheMessageCatalog">Configuring
 Validator Contraints in the Message Catalog</a></li><li><a  
href="#FormsandValidation-ValidationMacros">Validation Macros</a></li><li><a  
href="#FormsandValidation-OverridingtheTranslatorwithEvents">Overriding the 
Translator with Events</a></li></ul>
-</div><h2 id="FormsandValidation-TheFormComponent">The Form 
Component</h2><p>The core of Tapestry's form support is the <a  
class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Form.html";>Form</a>
 component. The Form component encloses (wraps around) all the other <em>field 
components</em> such as <a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/TextField.html";>TextField</a>,
 <a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/TextArea.html";>TextArea</a>,
 <a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Checkbox.html";>Checkbox</a>,
 etc.</p><h2 id="FormsandValidation-FormEvents">Form Events</h2><p>The Form 
component emits a number of <a  href="forms-and-validation.html">component 
events</a>. You'll want to provide event handler methods
  for some of these.</p><p>When rendering, the Form component emits two events: 
first, "prepareForRender", then "prepare". These allow the Form's container to 
set up any fields or properties that will be referenced in the form. For 
example, this is a good place to create a temporary entity object to be 
rendered, or to load an entity from a database to be edited.</p><p>When user 
submits the form on the client, a series of steps occur on the 
server.</p><p>First, the Form emits a "prepareForSubmit" event, then a 
"prepare" event. These allow the container to ensure that objects are set up 
and ready to receive information from the form submission.</p><p>Next, all the 
fields inside the form are <em>activated</em> to pull values out of the 
incoming request, validate them and (if valid) store the changes.</p><div 
class="navmenu" style="float:right; width:25%; background:#eee; margin:3px; 
padding:3px">
+</li></ul></div><h1 id="FormsandValidation-TheFormComponent">The Form 
Component</h1><p>The core of Tapestry's form support is the <a  
class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Form.html";>Form</a>
 component. The Form component encloses (wraps around) all the other <em>field 
components</em> such as <a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/TextField.html";>TextField</a>,
 <a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/TextArea.html";>TextArea</a>,
 <a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Checkbox.html";>Checkbox</a>,
 etc.</p><h2 id="FormsandValidation-FormEvents">Form Events</h2><p>The Form 
component emits a number of <a  href="forms-and-validation.html">component 
events</a>. You'll want to provide event handl
 er methods for some of these.</p><p>When rendering, the Form component emits 
two events: first, "prepareForRender", then "prepare". These allow the Form's 
container to set up any fields or properties that will be referenced in the 
form. For example, this is a good place to create a temporary entity object to 
be rendered, or to load an entity from a database to be edited.</p><p>When user 
submits the form on the client, a series of steps occur on the 
server.</p><p>First, the Form emits a "prepareForSubmit" event, then a 
"prepare" event. These allow the container to ensure that objects are set up 
and ready to receive information from the form submission.</p><p>Next, all the 
fields inside the form are <em>activated</em> to pull values out of the 
incoming request, validate them and (if valid) store the changes.</p><div 
class="navmenu" style="float:right; width:25%; background:#eee; margin:3px; 
padding:3px">
 <p><em>For Tapestry 4 Users:</em> Tapestry 5 does not use the fragile "form 
rewind" approach from Tapestry 4. Instead, a hidden field generated during the 
render stores the information needed to process the form 
submission.</p></div>&#160;<p>After the fields have done their processing, the 
Form emits a "validate" event. This is your chance to perform any cross-form 
validation that can't be described declaratively.</p><p>Next, the Form 
determines if there have been any validation errors. If there have been, then 
the submission is considered a failure, and a "failure" event is emitted. If 
there have been no validation errors, then a "success" event is 
emitted.</p><p>Finally, the Form emits a "submit" event, for logic that doesn't 
care about success or failure.</p><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Form Event (in order)</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Phase</p></th><th colspan
 ="1" rowspan="1" class="confluenceTh"><p>When emitted (and typical 
use)</p></th><th colspan="1" rowspan="1" class="confluenceTh">Method 
Name</th><th colspan="1" rowspan="1" class="confluenceTh">@OnEvent 
Constant</th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>prepareForRender</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Render</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Before rendering the form (e.g. load an 
entity from a database to be edited)</p></td><td colspan="1" rowspan="1" 
class="confluenceTd">onPrepareForRender()</td><td colspan="1" rowspan="1" 
class="confluenceTd">EventConstants.PREPARE_FOR_RENDER</td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>prepare</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Render</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Before rendering the form, but after 
<em>prepareForRender</em></p></td><td colspan="1" rowspan="1" c
 lass="confluenceTd">onPrepare()</td><td colspan="1" rowspan="1" 
class="confluenceTd">EventConstants.PREPARE</td></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><strong>prepareForSubmit</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Submit</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Before the submitted form is 
processed</p></td><td colspan="1" rowspan="1" 
class="confluenceTd">onPrepareForSubmit()</td><td colspan="1" rowspan="1" 
class="confluenceTd">EventConstants.PREPARE_FOR_SUBMIT</td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>prepare</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Submit</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Before the submitted form is processed, but after 
<em>prepareForSubmit</em></p></td><td colspan="1" rowspan="1" 
class="confluenceTd">onPrepare()</td><td colspan="1" rowspan="1" 
class="confluenceTd">EventConstants.PREPARE</td></tr><tr><td cols
 pan="1" rowspan="1" 
class="confluenceTd"><p><strong>validate</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Submit</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>After fields have been populated from submitted values 
and validated (e.g. perform cross-field validation)</p></td><td colspan="1" 
rowspan="1" class="confluenceTd">onValidate</td><td colspan="1" rowspan="1" 
class="confluenceTd">EventConstants.VALIDATE</td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>validateForm</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Submit</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>same as <em>validate (deprecated &#8211; do 
not use)<br clear="none"></em></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><em>onValidateForm</em></td><td colspan="1" rowspan="1" 
class="confluenceTd">&#160;</td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>failure</strong></p></td><td colspan=
 "1" rowspan="1" class="confluenceTd"><p>Submit</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>After one or more validation errors have 
occurred</p></td><td colspan="1" rowspan="1" 
class="confluenceTd">onFailure()</td><td colspan="1" rowspan="1" 
class="confluenceTd">EventConstants.FAILURE</td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>success</strong></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Submit</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>When validation has completed 
<em>without</em> any errors (e.g. save changes to the database)</p></td><td 
colspan="1" rowspan="1" class="confluenceTd">onSuccess()</td><td colspan="1" 
rowspan="1" class="confluenceTd">EventConstants.SUCCESS</td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>submit</strong></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Submit</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>After all validation (s
 uccess or failure) has finished</p></td><td colspan="1" rowspan="1" 
class="confluenceTd">onSubmit()</td><td colspan="1" rowspan="1" 
class="confluenceTd">EventConstants.SUBMIT</td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><strong>canceled</strong></td><td colspan="1" 
rowspan="1" class="confluenceTd">Submit</td><td colspan="1" rowspan="1" 
class="confluenceTd">Whenever a <em>Submit</em> or <em>LinkSubmit</em> 
component containing <em>mode="cancel"</em> or <em>mode="unconditional"</em> is 
clicked</td><td colspan="1" rowspan="1" 
class="confluenceTd">onCanceled()</td><td colspan="1" rowspan="1" 
class="confluenceTd">EventConstants.CANCELED</td></tr></tbody></table></div><p>Note
 that the "prepare" event is emitted during both form rendering and form 
submission.</p><h2 id="FormsandValidation-HandlingEvents">Handling 
Events</h2><p>Main Article: <a  href="forms-and-validation.html">Forms and 
Validation</a></p><p>You handle events by providing methods in your page or 
component c
 lass, either following the 
on<strong><em>Event</em></strong>From<strong><em>Component</em></strong>() 
naming convention or using the OnEvent annotation. For example:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Event Handler Using 
Naming Convention</b></div><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">    void onValidateFromPassword() { ...}</pre>
 </div></div><p>or the equivalent using @OnEvent:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>Event Handler Using @OnEvent 
Annotation</b></div><div class="codeContent panelContent pdl">
@@ -209,10 +212,10 @@ public class Login {
   &lt;label for="userName" class="control-label"&gt;User Name&lt;/label&gt;
   &lt;input id="userName" class="form-control" name="userName" type="text"&gt;
 &lt;/div&gt;</pre>
-</div></div><p>&#160;</p><p><span style="color: rgb(83,145,38);">Form 
Validation</span></p><p>The above example is a very basic form which allows the 
fields to be empty. However, with a little more effort we can add client-side 
validation to prevent the user from submitting the form with either field 
empty.</p><p>Validation in Tapestry involves associating one or 
more&#160;<em>validators</em> with a form element component, such as TextField 
or PasswordField. This is done using the <strong>validate</strong> 
parameter:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>&#160;</p><h1 id="FormsandValidation-FormValidation"><span 
style="color: rgb(83,145,38);">Form Validation</span></h1><p>The above example 
is a very basic form which allows the fields to be empty. However, with a 
little more effort we can add client-side validation to prevent the user from 
submitting the form with either field empty.</p><p>Validation in Tapestry 
involves associating one or more&#160;<em>validators</em> with a form element 
component, such as TextField or PasswordField. This is done using the 
<strong>validate</strong> parameter:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;t:textfield t:id="userName" validate="required" 
t:mixins="formgroup"/&gt;
 &lt;t:passwordfield t:id="password" value="password" validate="required" 
t:mixins="formgroup"/&gt;</pre>
-</div></div><p>&#160;</p><p><span style="color: rgb(83,145,38);">Available 
Validators</span></p><p>Tapestry provides the following built-in 
validators:</p><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Validator</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Constraint Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Example</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>email</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#8211;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Ensures that the given input looks like a valid e-mail 
address</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="email" validate="email" 
/&gt;</code></p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>max</p></td><td colspan="1" rowspan="
 1" class="confluenceTd"><p>long</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Enforces a maximum integer value</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>&lt;t:textfield 
value="age" validate="max=120,min=0" /&gt;</code></p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>maxLength</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>int</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Makes sure that a string value has a 
maximum length</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="zip" 
validate="maxlength=7" /&gt;</code></p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>min</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>long</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Enforces a minimum integer value</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>&lt;t:textfield 
value="age" validate="max=120,min=0" /&gt;
 </code></p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>minLength</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>int</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Makes sure that a string value has a minimum 
length</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="somefield" 
validate="minlength=1" /&gt;</code></p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#8211;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Does nothing (used to override a @Validate 
annotation)</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="somefield" validate="none" 
/&gt;</code></p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>regexp</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>pattern</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Makes su
 re that a string value conforms to a given pattern</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>&lt;t:textfield value="letterfield" 
validate="regexp=^</code><code>[A-Za-z]+$" /&gt;</code></p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>required</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#8211;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Makes sure that a string value is not null 
and not the empty string</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="name" validate="required" 
/&gt;</code></p></td></tr></tbody></table></div><h2 
id="FormsandValidation-CentralizingValidationwith@Validate">Centralizing 
Validation with @Validate</h2><p>The @<a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/Validate.html";>Validate</a>
 annotation can take the place of the validate parameter of TextField, 
PasswordField, TextArea and oth
 er components. When the validate parameter is not bound in the template file, 
the component will check for the @Validate annotation and use its value as the 
validation definition.</p><p>The annotation may be placed on the getter or 
setter method, or on the field itself.</p><p>Let's update the two fields of the 
Login page:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><h2 id="FormsandValidation-AvailableValidators"><span 
style="color: rgb(83,145,38);">Available Validators</span></h2><p>Tapestry 
provides the following built-in validators:</p><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Validator</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Constraint Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Example</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>email</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#8211;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Ensures that the given input looks like a valid e-mail 
address</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="email" validate="email" 
/&gt;</code></p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>max<
 /p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>long</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Enforces a maximum integer 
value</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="age" 
validate="max=120,min=0" /&gt;</code></p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>maxLength</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>int</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Makes sure that a string value has a maximum 
length</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="zip" 
validate="maxlength=7" /&gt;</code></p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>min</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>long</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Enforces a minimum integer value</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>&lt;t:textfield value="ag
 e" validate="max=120,min=0" /&gt;</code></p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>minLength</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>int</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Makes sure that a string value has a minimum 
length</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="somefield" 
validate="minlength=1" /&gt;</code></p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#8211;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Does nothing (used to override a @Validate 
annotation)</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="somefield" validate="none" 
/&gt;</code></p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>regexp</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>pattern</p></td><td colspan="1" rowspan="1"
  class="confluenceTd"><p>Makes sure that a string value conforms to a given 
pattern</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="letterfield" 
validate="regexp=^</code><code>[A-Za-z]+$" /&gt;</code></p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>required</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#8211;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Makes sure that a string value is not null 
and not the empty string</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>&lt;t:textfield value="name" validate="required" 
/&gt;</code></p></td></tr></tbody></table></div><h2 
id="FormsandValidation-CentralizingValidationwith@Validate">Centralizing 
Validation with @Validate</h2><p>The @<a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/Validate.html";>Validate</a>
 annotation can take the place of the validate parameter of TextField
 , PasswordField, TextArea and other components. When the validate parameter is 
not bound in the template file, the component will check for the @Validate 
annotation and use its value as the validation definition.</p><p>The annotation 
may be placed on the getter or setter method, or on the field 
itself.</p><p>Let's update the two fields of the Login page:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">  @Persist
   @Property
   @Validate("required")
@@ -221,7 +224,11 @@ public class Login {
   @Property
   @Validate("required")
  private String password;</pre>
-</div></div><p>Now, we'll rebuild the app, refresh the browser, and just hit 
enter:</p><p><span class="confluence-embedded-file-wrapper image-center-wrapper 
confluence-embedded-manual-size"><img class="confluence-embedded-image 
confluence-external-resource confluence-content-image-border image-center" 
width="500" 
src="https://cwiki-test.apache.org/confluence/download/attachments/22872109/newapp_com_example.png?version=3&amp;modificationDate=1428088849000&amp;api=v2";
 
data-image-src="https://cwiki-test.apache.org/confluence/download/attachments/22872109/newapp_com_example.png?version=3&amp;modificationDate=1428088849000&amp;api=v2";></span></p><p>The
 form has updated, in place, to present the errors. You will not be able to 
submit the form until some value is provided for each field.</p><h2 
id="FormsandValidation-ServerSideValidation">Server Side Validation</h2><p>Some 
validation can't, or shouldn't, be done on the client side. How do we know if 
the password is correct? Short of downlo
 ading all users and passwords to the client, we really need to do the 
validation on the server.</p><p>In fact, all client-side validation (via the 
validate parameter, or&#160;@Validate annotation) is performed again on the 
server.</p><p>It is also possible to perform extra validation there.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><p>Now, we'll rebuild the app, refresh the browser, and just hit 
enter:</p><p><span class="confluence-embedded-file-wrapper image-center-wrapper 
confluence-embedded-manual-size"><img class="confluence-embedded-image 
confluence-external-resource confluence-content-image-border image-center" 
width="500" 
src="https://cwiki-test.apache.org/confluence/download/attachments/22872109/newapp_com_example.png?version=3&amp;modificationDate=1428088849000&amp;api=v2";
 
data-image-src="https://cwiki-test.apache.org/confluence/download/attachments/22872109/newapp_com_example.png?version=3&amp;modificationDate=1428088849000&amp;api=v2";></span></p><p>The
 form has updated, in place, to present the errors. You will not be able to 
submit the form until some value is provided for each field.</p><h2 
id="FormsandValidation-HTML5Client-sideValidation">HTML5 Client-side 
Validation</h2><p>When the "tapestry.enable-html5-support" <a  
href="configuration.html">symbol</a> is set to true (it is <strong
 ><em>false</em></strong> by default), the Tapestry's built-in validators will 
 >automatically add the appropriate HTML5 "type" attributes to the rendered 
 >HTML of Tapestry's form components, triggering the HTML5 validation behavior 
 >built into most modern browsers. For example, if you use the "email" 
 >validator, like this:</p><div class="code panel pdl" style="border-width: 
 >1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">&lt;t:textfield value="user.emailAddress" 
validate="email" /&gt;</pre>
+</div></div><p>then the output HTML will look like this:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">&lt;input type="email" ...&gt;</pre>
+</div></div><p>The following HTML5 validation behaviors are 
enabled:</p><ul><li>The "<strong>required</strong>" validator adds the 
"required" attribute to the rendered HTML</li><li>The "<strong>regexp</strong>" 
validator adds the "pattern" attribute to the rendered HTML</li><li>The 
"<strong>email</strong>" validator sets the&#160;<code>type</code> attribute to 
"email" in the rendered HTML</li><li>The "<strong>min</strong>" validator sets 
the <code>type</code> attribute to "number" and adds the "min" attribute in the 
rendered HTML</li><li>The "<strong>max</strong>" validator sets the 
<code>type</code> attribute to "number" and adds the "max" attribute in the 
rendered HTML</li><li>When bound to a <strong>number</strong> type, the 
TextField component sets the&#160;<code>type</code> attribute to "number" in 
the rendered HTML</li></ul><h2 
id="FormsandValidation-ServerSideValidation">Server Side Validation</h2><p>Some 
validation can't, or shouldn't, be done on the client side. How do we k
 now if the password is correct? Short of downloading all users and passwords 
to the client, we really need to do the validation on the server.</p><p>In 
fact, all client-side validation (via the validate parameter, or&#160;@Validate 
annotation) is performed again on the server.</p><p>It is also possible to 
perform extra validation there.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">  /**
      * Do the cross-field validation
      */
@@ -233,7 +240,7 @@ public class Login {
     }
 
 </pre>
-</div></div><p>This is the validate event handler from the loginForm 
component. It is invoked once all the components have had a chance to read 
values out of the request, do their own validations, and update the properties 
they are bound to.</p><p>In this case, the authenticator is used to decide if 
the userName and password is valid. In a real application, this would be where 
a database or other external service was consulted.</p><p>If the combination is 
not valid, then the password field is marked as in error. The form is used to 
record an error, about a component (the passwordField) with an error 
message.</p><p>Entering any two values into the form and submitting will cause 
a round trip; the form will re-render to present the error to the 
user:</p><p><span class="confluence-embedded-file-wrapper image-center-wrapper 
confluence-embedded-manual-size"><img class="confluence-embedded-image 
confluence-external-resource confluence-content-image-border image-center" 
width="500" src="htt
 
ps://cwiki-test.apache.org/confluence/download/attachments/22872109/newapp_com_example.png?version=3&amp;modificationDate=1428088849000&amp;api=v2"
 
data-image-src="https://cwiki-test.apache.org/confluence/download/attachments/22872109/newapp_com_example.png?version=3&amp;modificationDate=1428088849000&amp;api=v2";></span></p><p>Notice
 that the cursor is placed directly into the password field.</p><div 
class="confluence-information-macro confluence-information-macro-note"><span 
class="aui-icon aui-icon-small aui-iconfont-warning 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>In versions of Tapestry prior to 
5.4, a form with validation errors would result in a redirect response to the 
client; often, temporary server-side data (such as the userName field) would be 
lost. Starting in 5.4, submitting a form with validation errors results in the 
new page being rendered in the same request as the form 
submission.</p></div></div><p>&#160;</p><h2 id
 ="FormsandValidation-CustomizingValidationMessages">Customizing Validation 
Messages</h2><p>Each validator (such as "required" or "minlength") has a 
default message used (on the client side and the server side) when the 
constraint is violated; that is, when the user input is not valid.</p><p>The 
message can be customized by adding an entry to the page's <a  
href="forms-and-validation.html">message catalog</a> (or the containing 
component's message catalog). As with any localized property, this can also go 
into the application's message catalog.</p><p>The first key checked is 
<em>formId</em>-<em>fieldId</em>-<em>validatorName</em>-message.</p><ul><li>formId:
 the local component id of the Form component</li><li>fieldId: the local 
component id of the field (TextField, etc.)</li><li>validatorName: the name of 
the validator, i.e., "required" or "minlength"</li></ul><p>If there is no 
message for that key, a second check is made, for 
<em>fieldId</em>-<em>validatorName</em>-message.&#160;<sp
 an>If</span><span>&#160;that does not match a message, then the built-in 
default validation message is used.</span></p><p><span>For example, if the form 
ID is "loginForm", the field ID is "userName", and the validator is "required" 
then Tapestry will first look for a "loginForm-userName-required-message" key 
in the message catalog, and then for a "<span>userName-required-message" 
key.</span></span></p><p>The validation message in the message catalog may 
contain <a  class="external-link" 
href="https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html"; 
rel="nofollow">printf-style format strings</a>&#160;(such as %s) to indicate 
where the validate parameter's value will be inserted. For example, if the 
validate parameter in the template is minLength=3 and the validation message is 
"User name must be at least %s characters" then the corresponding error message 
would be&#160;<span>"User name must be at least 5 characters".</span></p><h3 
id="FormsandValidation-CustomizingValidati
 onMessagesforBeanEditForm">Customizing Validation Messages for 
BeanEditForm</h3><p>The <a  href="forms-and-validation.html">BeanEditForm</a> 
component also supports validation message customizing. The search for messages 
is similar; the <em>formId</em> is the component id of the BeanEditForm 
component (not the Form component it contains). The <em>fieldId</em> is the 
property name.</p><h2 
id="FormsandValidation-ConfiguringValidatorContraintsintheMessageCatalog">Configuring
 Validator Contraints in the Message Catalog</h2><p>It is possible to omit the 
validation constraint from the validate parameter (or @Validator annotation), 
in which case it is expected to be stored in the message catalog.</p><p>This is 
useful when the validation constraint is awkward to enter inline, such as a 
regular expression for use with the regexp validator.</p><p>The key here is 
similar to customizing the validation message: 
<em>formId</em>-<em>fieldId</em>-<em>validatorName</em> or just 
<em>fieldId</em>-<em>
 validatorName</em>.</p><p>For example, your template may have the 
following:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>This is the validate event handler from the loginForm 
component. It is invoked once all the components have had a chance to read 
values out of the request, do their own validations, and update the properties 
they are bound to.</p><p>In this case, the authenticator is used to decide if 
the userName and password is valid. In a real application, this would be where 
a database or other external service was consulted.</p><p>If the combination is 
not valid, then the password field is marked as in error. The form is used to 
record an error, about a component (the passwordField) with an error 
message.</p><p>Entering any two values into the form and submitting will cause 
a round trip; the form will re-render to present the error to the 
user:</p><p><span class="confluence-embedded-file-wrapper image-center-wrapper 
confluence-embedded-manual-size"><img class="confluence-embedded-image 
confluence-external-resource confluence-content-image-border image-center" 
width="500" src="htt
 
ps://cwiki-test.apache.org/confluence/download/attachments/22872109/newapp_com_example.png?version=3&amp;modificationDate=1428088849000&amp;api=v2"
 
data-image-src="https://cwiki-test.apache.org/confluence/download/attachments/22872109/newapp_com_example.png?version=3&amp;modificationDate=1428088849000&amp;api=v2";></span></p><p>Notice
 that the cursor is placed directly into the password field.</p><div 
class="confluence-information-macro confluence-information-macro-note"><span 
class="aui-icon aui-icon-small aui-iconfont-warning 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>In versions of Tapestry prior to 
5.4, a form with validation errors would result in a redirect response to the 
client; often, temporary server-side data (such as the userName field) would be 
lost. Starting in 5.4, submitting a form with validation errors results in the 
new page being rendered in the same request as the form 
submission.</p></div></div><h2 id="FormsandVal
 idation-CustomizingValidationMessages">Customizing Validation 
Messages</h2><p>Each validator (such as "required" or "minlength") has a 
default message used (on the client side and the server side) when the 
constraint is violated; that is, when the user input is not valid.</p><p>The 
message can be customized by adding an entry to the page's <a  
href="forms-and-validation.html">message catalog</a> (or the containing 
component's message catalog). As with any localized property, this can also go 
into the application's message catalog.</p><p>The first key checked is 
<em>formId</em>-<em>fieldId</em>-<em>validatorName</em>-message.</p><ul><li>formId:
 the local component id of the Form component</li><li>fieldId: the local 
component id of the field (TextField, etc.)</li><li>validatorName: the name of 
the validator, i.e., "required" or "minlength"</li></ul><p>If there is no 
message for that key, a second check is made, for 
<em>fieldId</em>-<em>validatorName</em>-message.&#160;<span>If</span><
 span>&#160;that does not match a message, then the built-in default validation 
message is used.</span></p><p><span>For example, if the form ID is "loginForm", 
the field ID is "userName", and the validator is "required" then Tapestry will 
first look for a "loginForm-userName-required-message" key in the message 
catalog, and then for a "<span>userName-required-message" 
key.</span></span></p><p>The validation message in the message catalog may 
contain <a  class="external-link" 
href="https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html"; 
rel="nofollow">printf-style format strings</a>&#160;(such as %s) to indicate 
where the validate parameter's value will be inserted. For example, if the 
validate parameter in the template is minLength=3 and the validation message is 
"User name must be at least %s characters" then the corresponding error message 
would be&#160;<span>"User name must be at least 5 characters".</span></p><h3 
id="FormsandValidation-CustomizingValidationMessagesfor
 BeanEditForm">Customizing Validation Messages for BeanEditForm</h3><p>The <a  
href="forms-and-validation.html">BeanEditForm</a> component also supports 
validation message customizing. The search for messages is similar; the 
<em>formId</em> is the component id of the BeanEditForm component (not the Form 
component it contains). The <em>fieldId</em> is the property name.</p><h2 
id="FormsandValidation-ConfiguringValidatorContraintsintheMessageCatalog">Configuring
 Validator Contraints in the Message Catalog</h2><p>It is possible to omit the 
validation constraint from the validate parameter (or @Validator annotation), 
in which case it is expected to be stored in the message catalog.</p><p>This is 
useful when the validation constraint is awkward to enter inline, such as a 
regular expression for use with the regexp validator.</p><p>The key here is 
similar to customizing the validation message: 
<em>formId</em>-<em>fieldId</em>-<em>validatorName</em> or just 
<em>fieldId</em>-<em>validatorName
 </em>.</p><p>For example, your template may have the following:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">  &lt;t:textfield t:id="ssn" 
validate="required,regexp"/&gt;
 </pre>
 </div></div><p>And your message catalog can contain:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">


Reply via email to