On 03.09.2004 08:41, Derek Hohls wrote:

The current forms stylesheets supplied with Cocoon
work very well for most purposes... however, I now
have a quite crowded form where space is at a premium. Ideally I would only like to have one "hint"
symbol next to each field ie. if the field is required it
will have a "*". But if the user neglects to fill in that
field, and the form is redisplayed, there is a "!!" and "*"
This is actually redundant and also causes the form field
alignments to go out of sync.


If anyone knows of a way to ONLY display the validation
symbol and NOT the required symbol as well, please
let me know.

That's really easy :)

In forms-field-styling.xsl there is the following template:

  <!--+
      | Common stuff like fi:validation-message, @required.
      +-->
  <xsl:template match="fi:*" mode="common">
    <!-- validation message -->
    <xsl:apply-templates select="fi:validation-message"/>
    <!-- required mark -->
    <xsl:if test="@required='true'">
      <span class="forms-field-required"> * </span>
    </xsl:if>
  </xsl:template>

As you can see easily it results in both the ! and the *. If you import this stylesheet (or forms-samples-styling, which imports the forms-field-styling) you can overload the template, e.g. with the following:

  <xsl:template match="fi:*" mode="common">
    <xsl:variable name="validation-message">
      <xsl:apply-templates select="fi:validation-message"/>
    </xsl:variable>
    <xsl:copy-of select="$validation-message"/>
    <xsl:if test="@required='true' and
                  not(normalize-space($validation-message))">
      <span class="forms-field-required"> * </span>
    </xsl:if>
  </xsl:template>

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to