Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 19th, 2004, 11:24 AM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem displaying text fron Db to textarea

Hello,

I am using textarea in my form. I saved the text in Oracle. Before I display value for textarea, I used Replace method. Here is my code for Replace.


strrisks = rs("risks")
if isNULL(strrisks) then
strrisks = NULL
else
strrisks = Replace(strrisks, vbCrLf, "<BR>")
strrisks = Replace(strrisks, " ", "&nbsp;")
end if

when I have to display the data, I use this code....

<INPUT type="radio" name="chkrec" value="x"
             onclick=form1.risk.value='<%=strrisks%>'">

When it displays , it displays text with <BR>

line1<BR>lin2<BR>line3<BR>

Can someone please help me. I spent lot of time on this.

Thank you
  #2 (permalink)  
Old August 19th, 2004, 11:51 AM
Registered User
 
Join Date: Aug 2004
Location: , , United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think its coz you have this line using single quotes

Code:
<INPUT type="radio" name="chkrec" value="x" 
              onclick=form1.risk.value='<%=risks%>'">

---------------------------------------^==========^
Remove them and see what happens

  #3 (permalink)  
Old August 19th, 2004, 12:09 PM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It didn't work.

  #4 (permalink)  
Old August 19th, 2004, 08:07 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Mentiri, Muara, Brunei.
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

hello,

  risks is a server side variable and onclick is a client side event.

It is possible
<textarea name="txt1" rows="3" cols="20"><%=risks%></textarea>


other wise, store risks in a hidden field and in the radio onclick event, call that value from hidden field.



  #5 (permalink)  
Old August 20th, 2004, 08:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi there,

I assume that form1.risk refers to the textarea. If so, textarea doesn't have a value attribute. The text has to be displayed between <textarea> and </textarea> tags. So you cannot do it that way.

<textarea>my text</textarea>

Should do that as suggested by rajanikrishna. May be you can use an IF condition to check if Radio button is checked and based on that display the strrisks variable inbetween the textarea tags.

Also you don't have to replace VBCRLF with <BR> when you want to display that in a textarea, as it doesn't understand <BR> as line-break, instead VBCRLF would do that for you inside textarea.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to store textarea in a db? Hylsan PHP How-To 1 March 1st, 2007 07:51 AM
Displaying textarea content to html table keithc Pro PHP 2 December 1st, 2006 03:12 AM
html textarea to DB ginoitalo Beginning PHP 1 May 30th, 2005 01:49 AM
ASP: Textarea Problem when updating DB seala Access ASP 1 June 13th, 2003 12:35 PM
displaying a memo in a textarea jhunta Classic ASP Basics 1 June 9th, 2003 11:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.