I am trying to disable the user selecting a checkbox depending on whether they have a particular user role. My code detects the user's role correctly, and adds attributes like readonly to the input tag, however adding a disabled tag is not working for some unknown reason. This works for text input boxes but not checkboxes.
<xsl:template name="add-common-attributes">
<xsl:param name="field"/>
<xsl:param name="classes"/>
<xsl:attribute name="name" select="$field/@name"/>
<xsl:attribute name="class" select="concat($field/@name, $classes)"/>
<xsl:if test="$field/@editable = 'false' or ($field/@editable and not(fn:hasRole($field/@editable)))">
<xsl:attribute name="disabled">
<xsl:text>disabled</xsl:text>
</xsl:attribute>
<xsl:attribute name="readonly">
<xsl:text>readonly</xsl:text>
</xsl:attribute>
<xsl:attribute name="data-editable">
<xsl:value-of select="$field/@editable"/>
</xsl:attribute>
</xsl:if>
I have tried the above as well as <xsl:attribute name="disabled">disabled</xsl:attribute>
. Using the browser's inspect tool I can manually add the disabled attribute to the checkbox and it disables as expected, so I'm a lost as to why it is not working in the code.
Aucun commentaire:
Enregistrer un commentaire