cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Larson <timlarsonw...@yahoo.com>
Subject Woody textarea support and newline trouble
Date Tue, 26 Aug 2003 15:08:35 GMT
I tried adding textarea support to the field widget by modifying
a template in woody-default.xsl (see end of email for changes).
For example, to make a field widget use a textarea box you would
change the widget template to look like this:

  <wt:widget id="sampleTextarea">
    <textarea rows="10" cols="40"/>
  </wt:widget>

The remaining problem is that newlines double for each round trip
of the data.  This is a classic problem with textareas.  Anybody
know a good way to solve this that will work across different
browsers?  Should a new datatype converter be made for this?

--Tim Larson

Original template in woody-default.xsl:

  <xsl:template name="field">
    <xsl:param name="fieldelement"/>
    <input name="{$fieldelement/@id}" value="{$fieldelement/wi:value}">
      <xsl:if test="wi:styling">
        <xsl:copy-of select="wi:styling/@*"/>
      </xsl:if>
    </input>
  </xsl:template>

Modified version of template to support textareas:

  <xsl:template name="field">
    <xsl:param name="fieldelement"/>
    <xsl:choose>
      <xsl:when test="wi:styling/textarea">
        <textarea name="{@id}">
          <xsl:apply-templates select="wi:styling/textarea/@*"/>
          <xsl:value-of select="$fieldelement/wi:value"/>
        </textarea>
      </xsl:when>
      <xsl:otherwise>
        <input name="{$fieldelement/@id}" value="{$fieldelement/wi:value}">
          <xsl:if test="wi:styling">
            <xsl:copy-of select="wi:styling/@*"/>
          </xsl:if>
        </input>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

Mime
View raw message