Skip to main content
TurkeyChris
Participant
Oct 23, 2017 1:24 PM UTC
Question

How do I get the value of a text area?

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 is closed to new replies. Start a new post to keep the conversation going.

2 replies

BKBK
Community Expert
Community Expert
Oct 24, 2017 5:55 PM UTC

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.

Translate
Inspiring
Oct 23, 2017 2:59 PM UTC

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.

Translate