tags:

views:

71

answers:

2

Hi, I'm new to coldfusion.

I have page called test1.cfm

<form action = "test2.cfm" method = "post">
    Type your name and hit submit:<br>
   <input type = "Text" name = "txt1">
   <input type = "Submit" name = "" value = "submit">
</form>

And test2.cfm

<cfoutput>
    success
    #form.txt1#
    <a href="test1.cfm">back</a>
</cfoutput>

Now I want to know if we can encode the displaying of text value in test2.cfm page. For eg. if we type <br> in the textbox, test2 page will render it as html, and I want to stop rending and it should display as text.

Thanks

+4  A: 

Use #htmlCodeFormat(form.txt1)#

Pradeep
That isn't a built in function.
David Collie
I am not sure why this was down voted .. as htmlCodeFormat is a built in function. One adds pre tags the other does not: http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_h-im_03.html
Leigh
Yeah sorry Leigh, I totally messed that up on the not being a valid function. I promise will make it up. I blame iOS and it being a pain to do a quick google sanity check on my witterings!
David Collie
+4  A: 

It's HTMLEditFormat(), not code.

David Collie
No, both are valid functions.
Leigh
Both are valid functions, but `HtmlEditFormat` is the one to use for regular text display, since as you point out in the other question's comments `HtmlCodeFormat` wraps the text in `<pre>`...`</pre>` tags which is probably not desired.
Peter Boughton
Probably not. I should have emphasized that. So good point.
Leigh
Both are correct, but while displaying it, HTMLCodeFormat adds <pre> tag, which causes the display of content, more info here http://www.w3schools.com/TAGS/tag_pre.asp
Vikas