Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 18th, 2005, 01:42 AM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with Textarea

Hi
I am having a Parent window containing a Button(Add-Note),clicking on AddNote buuton,a child window will comes,which has a TEXTAREA and save buuton.
My Problem is "If we enter text it should be stored in the database and should be displayed in the parent window on clicking the save button in the child window.
I should capture the enter key(Carriage return in the child window,text area.

Ex:If I enter
"first line
second line"

in the text area it should be displayed as
"first line
second line"

but it is displaying in the single line like
"firstline secondline"


I need validation in Javascript

Thanks in Advance,

Regards,
Ram.

Reply With Quote
  #2 (permalink)  
Old August 22nd, 2005, 05:35 PM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

This could be due to the size of the textareas. Please keep same size for both textareas.


Om Prakash
Reply With Quote
  #3 (permalink)  
Old August 22nd, 2005, 11:21 PM
Authorized User
 
Join Date: Jul 2005
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi Om Prakash,
Thanks for reply
But I am not displaying in the Text area.
I am just collecting text from text area and storing it into the database and then displaying in the row of the table.

Thanks & Regards,
Ram.

Reply With Quote
  #4 (permalink)  
Old August 23rd, 2005, 06:37 AM
Friend of Wrox
 
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How about counting the amount of characters per-line in the textarea (should be able to get this from the COLS attribute of the textarea), then just put a newline character in there ('\n')?

Joe

Reply With Quote
  #5 (permalink)  
Old August 25th, 2005, 11:47 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

TEXTAREAs display text, not HTML, so linebreaks are encoded as \n. If you want to show the textarea's value ina div then set the innerText of the div, not the innerHTML.

--

Joe (Microsoft MVP - XML)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript textarea problem with FireFox dparsons Javascript How-To 0 May 19th, 2008 08:34 PM
display vbCrLf's from textarea to textarea mat41 Classic ASP Basics 8 June 10th, 2004 12:19 AM
Textarea problem chiraagb HTML Code Clinic 11 June 9th, 2004 11:25 AM
ASP: Textarea Problem when updating DB seala Access ASP 1 June 13th, 2003 12:35 PM



All times are GMT -4. The time now is 01:50 AM.


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