Add template macro to generate a list of hidden input form fields from a map passed from the controller.

This commit is contained in:
rjy7 2011-03-16 18:25:52 +00:00
parent 1bc5db2cd8
commit 2030220d70

View file

@ -5,9 +5,9 @@
<#--
Macro: optionGroups
Output a sequence of option groups with options.
Output: a sequence of option groups with options.
Input is a map of option groups to lists of Option objects.
Input: a map of option groups to lists of Option objects.
Usage: <@optionGroups groups=myOptionGroups />
-->
@ -24,9 +24,9 @@
<#--
Macro: options
Output a sequence of options.
Output: a sequence of options.
Input is a list of Option objects.
Input: a list of Option objects.
Usage: <@options opts=myOptions />
-->
@ -36,4 +36,21 @@
</#list>
</#macro>
<#---------------------------------------------------------------------------->
<#---------------------------------------------------------------------------->
<#--
Macro: hiddenInputs
Output hidden inputs from a map of names to values.
Input: a map of strings (names) to strings (values). May be null.
Usage: <@hiddenInputs inputs />
-->
<#macro hiddenInputs inputs="">
<#if inputs?has_content>
<#list inputs?keys as name>
<input type="hidden" name="${name}" value="${inputs[name]}" />
</#list>
</#if>
</#macro>