2006/unicorn/WebContent/WEB-INF/resources/templates/includes macros_index.vm,1.16,1.17

Update of /sources/public/2006/unicorn/WebContent/WEB-INF/resources/templates/includes
In directory hutz:/tmp/cvs-serv3621/WebContent/WEB-INF/resources/templates/includes

Modified Files:
	macros_index.vm 
Log Message:
checkbox options now keep their state (checked/unchecked) in case of an error

Index: macros_index.vm
===================================================================
RCS file: /sources/public/2006/unicorn/WebContent/WEB-INF/resources/templates/includes/macros_index.vm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- macros_index.vm	20 Oct 2009 12:45:31 -0000	1.16
+++ macros_index.vm	22 Oct 2009 16:26:18 -0000	1.17
@@ -73,8 +73,13 @@
 #macro(createCheckbox $param)
 #if ($param.getLongName($lang)) #set($param_name=$param.getLongName($lang)) #else #set($param_name=$param.getName()) #end
 #set($defaults = $param.getMapOfDefaultValue())
+#set( $D = '$' )
+#set ($a = "${D}!{param_${param.Name}}")
+#set ($paramValue = "#evaluate ($a)")
+#set ($s = '')
+#if (($paramValue != "" && $paramValue.equals('checked')) || ($paramValue == "" && $defaults.containsKey('checked'))) #set ($s = 'checked="checked"') #end
 <label><span>$param_name</span> 
-	<input type="checkbox" name="$param.getName()" value="$value.getName()"#if($defaults.containsKey($value.getName())) checked="checked" #end class="option_input" />
+	<input type="checkbox" name="$param.getName()" value="$param.getValue('checked').getName()" $s class="option_input" />
 </label>
 #end
 

Received on Thursday, 22 October 2009 16:26:24 UTC