- Revision
- 615
- Author
- mauro
- Date
- 2008-04-14 14:11:32 -0500 (Mon, 14 Apr 2008)
Log Message
Added waffle/validation.ftl. Updated freemarker-example.
Modified Paths
Added Paths
Diff
Modified: trunk/examples/freemarker-example/src/main/webapp/people/editperson.htm (614 => 615)
--- trunk/examples/freemarker-example/src/main/webapp/people/editperson.htm 2008-04-14 18:24:32 UTC (rev 614) +++ trunk/examples/freemarker-example/src/main/webapp/people/editperson.htm 2008-04-14 19:11:32 UTC (rev 615) @@ -1,18 +1,11 @@ <#import "/ftl/waffle/form.ftl" as w> +<#import "/ftl/waffle/validation.ftl" as v> <div class="editContainer" xmlns="http://www.w3.org/1999/xhtml"> <h3>Edit Person</h3> - <#if errors.hasErrorMessages()> - <div class="errors"> - <#list errors.allErrorMessages as error> - <div class="error"> - ${error.message} - </div> - </#list> - </div> - </#if> - + <@v.errorsAsDiv errors /> + <div class="fieldRow"> <label for="" <@w.text "person.id" "${person.id}" "readonly='true' disabled='true'"/>
Added: trunk/waffle-resources/src/main/resources/ftl/waffle/validation.ftl (0 => 615)
--- trunk/waffle-resources/src/main/resources/ftl/waffle/validation.ftl (rev 0) +++ trunk/waffle-resources/src/main/resources/ftl/waffle/validation.ftl 2008-04-14 19:11:32 UTC (rev 615) @@ -0,0 +1,23 @@ +<#ftl strip_whitespace=true> +<#-- + * A collection of FTL (Freemarker Template Language) validation functions and macros + * + * @author Mauro Talevi + --> + +<#-- + * Shows errors as Div with CSS class "errors". + * Each error is contained in div with class "error". + * + * @param errors the ErrorsContext + --> +<#macro errorsAsDiv errors> +<#if errors.hasErrorMessages()> + <div class="errors"> + <#list errors.allErrorMessages as error> + <div class="error">${error.message}</div> + </#list> + </div> +</#if> +</#macro> +
To unsubscribe from this list please visit:
