Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Coldfusion Bind

Posted on 2014-03-11
7
414 Views
Last Modified: 2014-04-09
I know you can use Coldfusion bind in a form field with something like this
 
<cfform >
 <cftextarea richtext="true" name="textName" skin="silver"
    toolbar="basic" height="300" Width="500"/>
    <br>
    <cftextarea  name="comment" bind=" {textName.text}" height="300" Width="500" />
</cfform>

Open in new window


but every time it shows in the comment field it shows the HTML code, is there a way to do this and it just show the information without the HTML code?

Im trying to have a editor on the side but it shows the changes in my template
0
Comment
Question by:overcolor
7 Comments
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 39922730
I believe you mean to show "HTML" in your text area element?

I think you probably need to use a 3rd party HTML editor component in your script.

For examples:

http://ckeditor.com/
http://premiumsoftware.net/cleditor/
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39923487
(no points. I don't have an answer ...)

@Chong Yit Seng - FYI: In case you are not familiar with <cftextarea richtext="true" ..> it is a thin wrapper that already incorporates the older FCKeditor

@overcolor - It might help others to clarify what you mean by "just show the information without the HTML code?" For example, if this were the base entry:

       form.textName => This is an example of <strong>bold text</strong>

Do you mean show the plain text, without any html tags? ie

       form.comment  => This is an example of bold text

... OR display the rendered html?

       form.comment  => This is an example of bold text
0
 
LVL 4

Expert Comment

by:Rodrigo Munera
ID: 39923939
To add on to what _agx_ was saying:

Yes, ckeditor is a newer version of the richtext="true" implementation of cftextarea.

But basically what's happening is:

your "textName" cftextarea element has richtext="true" on it, which means that everything you write in it will have html code in it.

When you bind the content of "textName" into "comments" cftextarea, you're asking the "comments" area to use the exact same contents as "textName".

To have both elements identical there are several options.

1. Make richtext="true" on both cftextarea elements
2. Remove richtext="true" from both elements
3. Use something like jQuery's text() to strip the tags off of the content (http://api.jquery.com/text/) off of textName when binding it into comments.
4. for something that only targets specific tags, you can write regex to selectively remove tags (http://stackoverflow.com/questions/13140043/how-to-strip-html-tags-with-jquery) off of textName when binding it into comments.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:overcolor
ID: 39924223
_agx_

That is what I'm trying to do

 display the rendered html?

       form.comment  => This is an example of bold text

 I'm hoping to build this so they can make edits to the text on one side of the page with the cftextarea and it displays the rendered output on the other side of the page
0
 
LVL 4

Expert Comment

by:Rodrigo Munera
ID: 39925042
Add richtext="tree" to the comments cftextarea.
0
 

Accepted Solution

by:
overcolor earned 0 total points
ID: 39926946
I got it

<cfdiv bind="{textName}"></cfdiv>
0
 

Author Closing Comment

by:overcolor
ID: 39936363
this will solve the issue
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question