Wrox Programmer Forums
| 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 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 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.

  #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
  #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.

  #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

  #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)


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





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