You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2004/08/20 09:16:55 UTC

svn commit: rev 36653 - in cocoon/branches/BRANCH_2_1_X/src/blocks: forms/samples/resources woody/samples/resources

Author: cziegeler
Date: Fri Aug 20 00:16:53 2004
New Revision: 36653

Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/resources/forms-field-styling.xsl
   cocoon/branches/BRANCH_2_1_X/src/blocks/woody/samples/resources/woody-field-styling.xsl
Log:
Fix problem when booleanfield is hidden

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/resources/forms-field-styling.xsl
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/resources/forms-field-styling.xsl	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/resources/forms-field-styling.xsl	Fri Aug 20 00:16:53 2004
@@ -20,7 +20,7 @@
                 exclude-result-prefixes="fi">
   <!--+
       | This stylesheet is designed to be included by 'forms-samples-styling.xsl'.
-      | Version CVS $Id: forms-field-styling.xsl,v 1.8 2004/04/22 14:27:58 mpo Exp $
+      | Version CVS $Id$
       +-->
 
   <!-- Location of the resources directory, where JS libs and icons are stored -->
@@ -259,13 +259,24 @@
 
   <!--+
       | fi:booleanfield : produce a checkbox
+      | A hidden booleanfield is not a checkbox, so 'value' contains 
+      | the value and not the checked attribute
       +-->
   <xsl:template match="fi:booleanfield">
     <input id="{@id}" type="checkbox" value="true" name="{@id}" title="{fi:hint}">
       <xsl:apply-templates select="." mode="styling"/>
-      <xsl:if test="fi:value = 'true'">
-        <xsl:attribute name="checked">checked</xsl:attribute>
-      </xsl:if>
+      <xsl:choose>
+        <xsl:when test="./fi:styling[@type='hidden']">
+          <xsl:if test="fi:value = 'false'">
+            <xsl:attribute name="value">false</xsl:attribute>
+          </xsl:if>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="fi:value = 'true'">
+            <xsl:attribute name="checked">checked</xsl:attribute>
+          </xsl:if>
+        </xsl:otherwise>
+      </xsl:choose>
     </input>
     <xsl:apply-templates select="." mode="common"/>
   </xsl:template>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/woody/samples/resources/woody-field-styling.xsl
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/woody/samples/resources/woody-field-styling.xsl	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/woody/samples/resources/woody-field-styling.xsl	Fri Aug 20 00:16:53 2004
@@ -20,7 +20,7 @@
                 exclude-result-prefixes="wi">
   <!--+
       | This stylesheet is designed to be included by 'woody-samples-styling.xsl'.
-      | Version CVS $Id: woody-field-styling.xsl,v 1.48 2004/04/21 14:00:03 joerg Exp $
+      | Version CVS $Id$
       +-->
 
   <!-- Location of the resources directory, where JS libs and icons are stored -->
@@ -258,13 +258,24 @@
 
   <!--+
       | wi:booleanfield : produce a checkbox
+      | A hidden booleanfield is not a checkbox, so 'value' contains 
+      | the value and not the checked attribute
       +-->
   <xsl:template match="wi:booleanfield">
     <input id="{@id}" type="checkbox" value="true" name="{@id}" title="{wi:hint}">
       <xsl:apply-templates select="." mode="styling"/>
-      <xsl:if test="wi:value = 'true'">
-        <xsl:attribute name="checked">checked</xsl:attribute>
-      </xsl:if>
+      <xsl:choose>
+          <xsl:when test="./wi:styling[@type='hidden']">
+          <xsl:if test="wi:value = 'false'">
+            <xsl:attribute name="value">false</xsl:attribute>
+          </xsl:if>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="wi:value = 'true'">
+            <xsl:attribute name="checked">checked</xsl:attribute>
+          </xsl:if>
+        </xsl:otherwise>
+      </xsl:choose>
     </input>
     <xsl:apply-templates select="." mode="common"/>
   </xsl:template>