cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Noels <>
Subject Re: Woody textarea support and newline trouble
Date Tue, 26 Aug 2003 15:21:33 GMT
On Tue, 26 Aug 2003, Timothy Larson wrote:

> 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?

Just make sure your encoding is consistently set across your application. 
I had the same problem lately, and now, I've standardized on ISO-8859-1 
everywhere (for this application). That meant tweaking the map:serializer 

> 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>

Funny: mine is exactly the same. :-)


View raw message