Share via


3.4.1.2 Check Box Control

The following XSL examples are check box controls, as specified in section 2.3.1.2.

The following example is a check box control with the value "1" if the control is not checked, and zero ("0") if the control is checked. When the user hovers over the control with the cursor, it displays the message "this is a checkbox".

 <input class="xdBehavior_Boolean" title="this is a checkbox" type="checkbox" xd:binding="my:field1" xd:boundProp="xd:value" xd:offValue="1" xd:onValue="0" tabIndex="0" xd:xctname="CheckBox" xd:CtrlId="CTRL1">
     <xsl:attribute name="xd:value">
         <xsl:value-of select="my:field1" /> 
     </xsl:attribute>
     <xsl:if test="my:field1=&quot;true&quot;">
         <xsl:attribute name="CHECKED">CHECKED</xsl:attribute> 
     </xsl:if>
 </input>

The following example is a check box control with the value "false" if the control is not checked, and "true" if the control is checked. Conditional formatting is set such that if the control is checked, the control is disabled.

 <input class="xdBehavior_Boolean" title="" type="checkbox" xd:binding="my:field2" xd:boundProp="xd:value" xd:offValue="false" xd:onValue="true" tabIndex="0" xd:xctname="CheckBox" xd:CtrlId="CTRL2">
     <xsl:choose>
         <xsl:when test="my:field2 = string(true())">
             <xsl:attribute name="disabled">true</xsl:attribute> 
         </xsl:when>
     </xsl:choose>
     <xsl:attribute name="xd:value">
         <xsl:value-of select="my:field2" /> 
     </xsl:attribute>
     <xsl:if test="my:field2=&quot;true&quot;">
         <xsl:attribute name="CHECKED">CHECKED</xsl:attribute> 
     </xsl:if>
 </input>