SPR-4700 - Add single checkbox input macro for Velocity and Freemarker

This commit is contained in:
Arjen Poutsma
2009-08-05 12:16:11 +00:00
parent 7043dff97b
commit 93e99556c0
6 changed files with 55 additions and 0 deletions

View File

@@ -296,6 +296,23 @@
<input type="hidden" name="_${status.expression}" value="on"/>
</#macro>
<#--
* formCheckbox
*
* Show a single checkbox.
*
* @param path the name of the field to bind to
* @param attributes any additional attributes for the element (such as class
* or CSS styles or size
-->
<#macro formCheckbox path attributes="">
<@bind path />
<#local checked><#if status.value?? && status.value?string=="true">true<#else>false</#if></#local>
<#local id><#if status.expression??>${status.expression}<#else>${path}</#if></#local>
<input type="hidden" name="_${id}" value="on"/>
<input type="checkbox" id="${id}" name="${id}" checked="${checked}" ${attributes}/>
</#macro>
<#--
* showErrors
*

View File

@@ -269,6 +269,21 @@
<input type="hidden" name="_${status.expression}" value="on"/>
#end
#**
* springFormCheckbox
*
* Show a single checkbox.
*
* @param path the name of the field to bind to
* @param attributes any additional attributes for the element (such as class
* or CSS styles or size
*#
#macro( springFormCheckbox $path $attributes )
#springBind($path)
<input type="hidden" name="_${status.expression}" value="on"/>
<input type="checkbox" id="${status.expression}" name="${status.expression}" checked="#if("$!{status.value}"=="true")true#{else}false#end" ${attributes}/>
#end
#**
* springShowErrors
*