Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea
Go Back  Xtreme Visual Basic Talk > > > Format TD based on Fomat used in TextArea


Reply
 
Thread Tools Display Modes
  #1  
Old 12-04-2006, 02:07 PM
mountainbiking's Avatar
mountainbiking mountainbiking is offline
Junior Contributor
 
Join Date: Oct 2002
Posts: 259
Default Format TD based on Fomat used in TextArea


I have a form where users add data. Simailar to these message boards... users add questions in a textarea. When the data is submitted it is displayed in a table. How can I apply the same formatting to the <TD> as the <textarea> has? An example could be a user adds this to a textarea:

This is a test.

My name is User.

Thanks.

But in the <TD> it will display This is a test. My name is User. Thanks.


Any thoughts on this would be appreciated.
Reply With Quote
  #2  
Old 12-04-2006, 02:08 PM
Volte's Avatar
VolteFormat TD based on Fomat used in TextArea Volte is offline
Ultimate Contributor

Retired Leader
* Guru *
 
Join Date: Aug 2001
Posts: 5,344
Default

What language are you using?
Reply With Quote
  #3  
Old 12-04-2006, 02:19 PM
mountainbiking's Avatar
mountainbiking mountainbiking is offline
Junior Contributor
 
Join Date: Oct 2002
Posts: 259
Default

Sorry, I forgot to mention that I am using ASP/HTML


Quote:
Originally Posted by mountainbiking
I have a form where users add data. Simailar to these message boards... users add questions in a textarea. When the data is submitted it is displayed in a table. How can I apply the same formatting to the <TD> as the <textarea> has? An example could be a user adds this to a textarea:

This is a test.

My name is User.

Thanks.

But in the <TD> it will display This is a test. My name is User. Thanks.


Any thoughts on this would be appreciated.
Reply With Quote
  #4  
Old 12-04-2006, 02:21 PM
Volte's Avatar
VolteFormat TD based on Fomat used in TextArea Volte is offline
Ultimate Contributor

Retired Leader
* Guru *
 
Join Date: Aug 2001
Posts: 5,344
Default

Here is a link that describes the basics of transferring and displaying data over multiple pages using HTML forms with ASP: http://www.w3schools.com/asp/asp_inputforms.asp

And here is a link that describes HTML forms themselves: http://www.w3schools.com/html/html_forms.asp
Reply With Quote
  #5  
Old 12-04-2006, 02:34 PM
mountainbiking's Avatar
mountainbiking mountainbiking is offline
Junior Contributor
 
Join Date: Oct 2002
Posts: 259
Default

Thanks for the links.... that doesn't tell me anything I already don't know though... I am an experienced programmer... one thing I have never had the need to do is format data in a table as it is entered in a textarea. The link you sent is 101 for people just familiarizing themselves with HTML forms.

I know that some how 'behind the scenes' when a user is entering data in a textarea and the press enter for the next line that when the data is displayed in HTML that a <BR> will be required I just don't know how to tell the <TD> to display information as added in the textbox. The DB holds the formatting because if a user edit's data the data appears with all the proper formatting in the textarea.

Quote:
Originally Posted by Volte
Here is a link that describes the basics of transferring and displaying data over multiple pages using HTML forms with ASP: http://www.w3schools.com/asp/asp_inputforms.asp

And here is a link that describes HTML forms themselves: http://www.w3schools.com/html/html_forms.asp
Reply With Quote
  #6  
Old 12-04-2006, 02:38 PM
Volte's Avatar
VolteFormat TD based on Fomat used in TextArea Volte is offline
Ultimate Contributor

Retired Leader
* Guru *
 
Join Date: Aug 2001
Posts: 5,344
Default

Ah sorry if I seemed patronizing; I guess I misunderstood the question. Are you saying you want to fix the line-breaks? In that case you should be able to use the Replace() function to replace vbCrLf with "<br>vbCrlf", assuming I am understanding correctly how the data is stored in the database.
Reply With Quote
  #7  
Old 12-04-2006, 02:51 PM
mountainbiking's Avatar
mountainbiking mountainbiking is offline
Junior Contributor
 
Join Date: Oct 2002
Posts: 259
Default

Think about when you type in a reply to this post... when i press enter
It goes to the next line.

I want this formatting to portray to the <TD>.

This website is a good example because this does exactly what I am looking to do.

Is my request clear or do I need to provide more info? Just think when you are reading this that this is exactly how I typed it in the textarea.... and when strong to the DB the value in the textarea does not have any vbCrlf. It just has straight text, but when editing the text in the textarea, the same attributes in terms of formatting is returned.


Quote:
Originally Posted by Volte
Ah sorry if I seemed patronizing; I guess I misunderstood the question. Are you saying you want to fix the line-breaks? In that case you should be able to use the Replace() function to replace vbCrLf with "<br>vbCrlf", assuming I am understanding correctly how the data is stored in the database.
Reply With Quote
  #8  
Old 12-04-2006, 03:00 PM
Volte's Avatar
VolteFormat TD based on Fomat used in TextArea Volte is offline
Ultimate Contributor

Retired Leader
* Guru *
 
Join Date: Aug 2001
Posts: 5,344
Default

It seems strange to me that it's not storing the vbCrLf. What are you using to view the contents of the database? Does it appear formatted correctly in the source code of the page if you View->Source?
Reply With Quote
  #9  
Old 12-04-2006, 03:03 PM
wayneph's Avatar
waynephFormat TD based on Fomat used in TextArea wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

I'd personally use something like www.fckeditor.net to enter the data. Then they will enter the data like they want it displayed. I prefer it to a TextArea, and the proper HTML is stored.

Otherwise, you will have to manually replace vbCrLf with <br />.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #10  
Old 12-04-2006, 03:06 PM
mountainbiking's Avatar
mountainbiking mountainbiking is offline
Junior Contributor
 
Join Date: Oct 2002
Posts: 259
Default

I am using Access for this particular application.... everything looks normal... look at the example I created of formatting:

<textarea rows="11" name="S1" cols="49">This is a test
I
Love
America

The End</textarea>

If you copy that text to a HTML editor it will display with the spacing.....

Quote:
Originally Posted by Volte
It seems strange to me that it's not storing the vbCrLf. What are you using to view the contents of the database? Does it appear formatted correctly in the source code of the page if you View->Source?
Reply With Quote
  #11  
Old 12-04-2006, 03:20 PM
wayneph's Avatar
waynephFormat TD based on Fomat used in TextArea wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

I guess another option would be to change the whitespace css property in your table cell.

HTML Code:
<td style="white-space:pre;">I
Love
America

The End</td>
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #12  
Old 12-05-2006, 07:10 AM
mountainbiking's Avatar
mountainbiking mountainbiking is offline
Junior Contributor
 
Join Date: Oct 2002
Posts: 259
Default

All the CSS properties I have played with don't give me the formatting that i need either. I am surprised that the <textarea> is not giving me a vbcrlf when the user presses enter. It doesn't though. Below is the text from one of the tables that I wast to display the proper format from the textbox.


<td colspan="5" align="center">
<p align="left"><b>nbsp;Team,

FYI, just wanted to let everybody know that if you need to add F8 to a 2F application.

</b></td>

You can see the DB returns the fact that there was a carriage return as shown in Team,

FYI....


Any other suggestions?
Reply With Quote
  #13  
Old 12-05-2006, 07:23 AM
wayneph's Avatar
waynephFormat TD based on Fomat used in TextArea wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

It IS giving you a vbCrLf. HTML ignores it by design. White Space doesn't matter. That's why I suggested changing the way the white space property is set up.

Try something like this (which I also mentioned in post 9)...
HTML Code:
<td>Replace(rs("yourField"), vbCrLf, "<br>")</td>
This will explicitly replace the New Line with the appropriate HTML equivalent.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #14  
Old 12-05-2006, 07:37 AM
mountainbiking's Avatar
mountainbiking mountainbiking is offline
Junior Contributor
 
Join Date: Oct 2002
Posts: 259
Default

Wayneph:

Thanks you were correct. I had the same string in there last night except by accident I placed quotes around the vbcrlf like below:


<td>Replace(rs("myfield"), "vbCrLf", "<br>")</td>

I removed them and it worked great. Thanks for the good eye on the important details.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea
 
Format TD based on Fomat used in TextArea
Format TD based on Fomat used in TextArea
 
-->