cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: Textarea field problem with cforms/flow
Date Tue, 13 Dec 2005 19:57:20 GMT
No,

What you are describing, is that you have a textarea in which you edit some text and save
it in a database.
The next time you edit the same textarea field, it already contains the text you saved before.
When you save again, it doubles your enters, right?

This is solved, by making sure, that with displaying the textarea field, you do not have 
<xsl:copy-of select="xpath2yourfield-text"/> (or ofcourse value-of), but you must have

<xsl:copy-of select="translate(xpath2yourfield-text, '&#13;', '')"/>

So, you had it with Cforms isn't? So look up the file forms-field-styling.xsl. Look for textarea.

Somewhere in that file, I am having 
<xsl:template match="fi:field[fi:styling/@type='textarea']">
    <textarea id="{@id}" name="{@id}" title="{fi:hint}">
      <xsl:apply-templates select="." mode="styling"/>
      <!-- remove carriage-returns (occurs on certain versions of IE and doubles linebreaks
at each submit) -->
      <xsl:copy-of select="translate(fi:value/node(), '&#13;', '')"/>
    </textarea>
    <xsl:apply-templates select="." mode="common"/>
</xsl:template>

where you probably have a copy-of without the translate...use this one, that should really
do the job, and nothing more. 

Make sure, that when you save this file, you eiter restart your site or make sure you change
forms-samples-styling.xsl (trivial space or something) and save that xsl, since it imports
the forms-field-styling.xsl. If you do not save this file, cocoon won't recognize that its
imported xsl is changed, and nothing will change.

Hope you manage

AS 

> 
> 
> AS
> 
> Thanks for this... but I am not sure what to do with it?  Do
> you suggest I have an extra XSLT post-processing the form?
> If so, how and where would I configure it?  If not, what else
> should I be doing?
>  
> Thanks!
> Derek
> 
> >>> a.schrijvers@hippo.nl 2005/12/13 03:12 PM >>>
> Experienced the same stupid behavior of textarea in 
> combination with CFORMS. 
> 
> Quick and dirty solution:
> 
> <textarea id="interesses">
> <xsl:copy-of select="translate(xpath2yourfield-text, '&#13;', '')"/>
> </textarea>
> 
> If you don't want to spend much time on it, this solution 
> works, if you do want to spend time, plz let me know if you 
> find a decent solution
> 
> AS
> 
> 
> > 
> > 
> > I have data from a database that I display in a CForm and 
> > allow a user to update.
> > 
> > The text is displayed in the textarea of a form; when there is a
> > long string, the text simply wraps and all is fine.
> > 
> > However, each time a CR is entered from the keyboard then, 
> > after the data gets saved to the database, an extra CR (&#13;) 
> > gets added to each existing CR as well, resulting in more and
> > more blank lines being inserted.
> > 
> > How do I prevent this happening?
> > 
> > Thanks
> > Derek
> > 
> > 
> > -- 
> > This message is subject to the CSIR's copyright, terms and 
> > conditions and
> > e-mail legal notice. Views expressed herein do not 
> > necessarily represent the
> > views of the CSIR.
> > 
> > CSIR E-mail Legal Notice
> > http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
> > 
> > CSIR Copyright, Terms and Conditions
> > http://mail.csir.co.za/CSIR_Copyright.html 
> > 
> > For electronic copies of the CSIR Copyright, Terms and 
> > Conditions and the CSIR
> > Legal Notice send a blank message with REQUEST LEGAL in the 
> > subject line to
> > HelpDesk@csir.co.za .
> > 
> > 
> > This message has been scanned for viruses and dangerous 
> > content by MailScanner, 
> > and is believed to be clean. MailScanner thanks Transtec 
> > Computers for their support.
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
> > For additional commands, e-mail: users-help@cocoon.apache.org 
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
> For additional commands, e-mail: users-help@cocoon.apache.org 
> 
> 
> 
> 
> -- 
> This message is subject to the CSIR's copyright, terms and 
> conditions and
> e-mail legal notice. Views expressed herein do not 
> necessarily represent the
> views of the CSIR.
>  
> CSIR E-mail Legal Notice
> http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
>  
> CSIR Copyright, Terms and Conditions
> http://mail.csir.co.za/CSIR_Copyright.html 
>  
> For electronic copies of the CSIR Copyright, Terms and 
> Conditions and the CSIR
> Legal Notice send a blank message with REQUEST LEGAL in the 
> subject line to
> HelpDesk@csir.co.za.
> 
> 
> This message has been scanned for viruses and dangerous 
> content by MailScanner, 
> and is believed to be clean.  MailScanner thanks Transtec 
> Computers for their support.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message