Skip to main content
TurkeyChris
Participant
October 23, 2017
Question

How do I get the value of a text area?

  • October 23, 2017
  • 2 replies
  • 971 views

I am a novice when it comes to CF.  Our company uses CF16.   I am copying existing code from one our other websites, however nobody is around that worked on it so there is nobody to ask.

The code displays a hidden <td> holder called "help_field_1new".  This is used for entering new help information.  When a button is pressed to add a new record the program updates the innerHTML to a textarea field  (code = (document.getElementById(help_field_1new).innerHTML = "<textarea name='help_field_1_textnew cols='70' rows='3' onKeyUp='validateLen(event,this,2000);' onPaste='return validateLen(event,this,2000); return validEntry(event);' onDrop='return validateLen(event,this,2000); return validEntry(event);'>"+document.getElementById(help_field_1new).innerHTML+"</textarea>")

The problem is that I can't figure out how to retrieve the actual value that is entered....

I've tried document.getElementById, but all I get is the actual HTML.

Advice?

Thanks.

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
October 24, 2017

First of all, the code you've given contains an error. There should be an extra single quote to delimit the name. That is, name='help_field_1_textnew' cols='70' in place of name='help_field_1_textnew cols='70'. It might be possible to get the value of the teaxtarea, in the action page, as form.help_field_1_textnew.

Inspiring
October 23, 2017

You would be better off asking this over at Stack Overflow - Where Developers Learn, Share, & Build Careers  as its a Javascript question rather then Coldfusion.

If you are looking to get the content of the <td> then you can use '.text' function

Otherwise its a bit hard to see what you are trying to achieve without all the code and formatting etc.