Author: buildbot
Date: Fri Nov 25 13:19:47 2016
New Revision: 1001636

Log:
Production update by buildbot for tapestry

Modified:
    websites/production/tapestry/content/cache/main.pageCache
    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/forms-and-validation.html
==============================================================================
--- websites/production/tapestry/content/forms-and-validation.html (original)
+++ websites/production/tapestry/content/forms-and-validation.html Fri Nov 25 
13:19:47 2016
@@ -83,11 +83,11 @@
   <div class="details"> 
    <a  href="bean-validation.html">Bean Validation</a> 
   </div> </li></ul></div><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.rbtoc1478607656186 {padding: 0px;}
-div.rbtoc1478607656186 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1478607656186 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1480079973894 {padding: 0px;}
+div.rbtoc1480079973894 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1480079973894 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1478607656186">
+/*]]>*/</style></p><div class="toc-macro rbtoc1480079973894">
 <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 class="toc-indentation"><li><a  
href="#FormsandValidation-CustomizingValidationMessagesforBeanEditForm">Customizing
 Validation Messages for BeanEditForm</a></li></ul>
@@ -196,7 +196,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-content-image-border image-center" width="500" 
src="forms-and-validation.data/newapp
 _com_example.png"></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 m
 essage can be customized by adding an entry to the page's <a  
href="localization.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"<br clear="none"> If there is not 
message for that key, a second check is made, for 
<em>fieldId</em>-<em>validatorName</em>-message.</li></ul><p>If that does not 
match a message, then the built-in default validation message is used.</p><h3 
id="FormsandValidation-CustomizingValidationMessagesforBeanEditForm">Customizing
 Validation Messages for BeanEditForm</h3><p>The <a  
href="beaneditform-guide.html">BeanEditForm</a> component also supp
 orts 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 p
 anelContent 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-content-image-border image-center" width="500" 
src="forms-and-validation.data/newapp
 _com_example.png"></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 m
 essage can be customized by adding an entry to the page's <a  
href="localization.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 style="font-size: 
14.0px;">If</span><span style="font-size: 14.0px;">&#160;that does not match a 
message, then the built-in default validation message is 
used.</span></p><p><span style="font-size: 14.0px;">For example, if the form ID 
is "loginForm", the field ID is "userName", and the validator is "re
 quired" 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-CustomizingValidationMessagesforBeanEditForm">Customizing
 Validation Messages for BeanEditForm</h3><p>The <a  
href="beaneditform-guide.html">BeanEditForm</a> component also supports 
validation message customizing. The search for messages is si
 milar; 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