Solved

Commas in textarea value

Posted on 2004-08-18
3
238 Views
Last Modified: 2012-05-05
Hi,

I have a textarea on my page.
The contents of the textarea are provided by an ASP recordset value, However the user can amend the contents.
When i get the value from the textarea (using document.frmThisForm.txtTextArea.value)
I get 4 commas returned after the characters that I have entered.
If I enter nothing I still get the 4 commas returned.

And sometimes the contents of the box are returned as 'undefined'

Why is this happening?
Thanks
Suzanne
0
Comment
Question by:smurray20
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
peh803 earned 125 total points
ID: 11830713
can you post the code, please?  It sounds like you might have 4 text areas with the same name on the form....could this be possible?  If this is the case, the values posted on a form post are all delimited by commas...

Anyways, a quick look at the code should help to clear things up..

regards,
peh803
0
 

Author Comment

by:smurray20
ID: 11830781
You're right!
That was driving me crazy!

Ive got a bit of a tricky situation though -
Users can have up to 4 items (each item consists of 3 textareas) - ive just used a loop around one row of a table for each item.
They can create blank items and then complete them in their own time.
They select a number between 1 and 4 from a dropdown but there is the option to add another item afterwards.

Ive been using onChange to set a variable to know if the textarea has been changed.
But i'm not sure that since i have up to possibly 12 textareas - how will i know which ones to update?
and how will i control the updating?

I know this isnt the original post but if you have any ideas I'd be very greatful!
Thanks
Suzanne
0
 
LVL 19

Expert Comment

by:peh803
ID: 11830833
Why not just update each text area each time?  That way, you don't have to keep track of which ones have changed and which ones haven't, you don't have to write any complex code to interpret your flags, etc.  The database hit to update 12 items instead of 9 is relatively small, as long as you do it all within the same opened connection..  Obviously, you probably have good reasons to not want to update EVERY one EVERY time, so if you want to stick to this, let me know and I can help you come up with something (separate question / points, perhaps?)

Thanks,
peh803
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now