Solved

How do I read textarea value ?

Posted on 2002-04-19
8
2,372 Views
Last Modified: 2009-12-16
How do I read textarea value ?
0
Comment
Question by:tanc02
  • 3
  • 3
  • 2
8 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 6954292
What do you mean? If you have a form named SomeForm and a textarea named SomeTextArea, you can access the value by:

strText=document.SomeForm.SomeTextArea.value
0
 
LVL 1

Author Comment

by:tanc02
ID: 6954308
but I got object required error.
0
 
LVL 1

Author Comment

by:tanc02
ID: 6954318
Sorry ! It is object expected.

Here is my code :

<form name="SomeForm">
<textarea name="SomeTextArea" rows=5 cols=50 onChange="javascript:setFlag()"></textarea>
<input type="button" value="Submit" onClick="tell()">
</form>

<script>
function tell(){
alert(document.SomeForm.SomeTextArea.value);
}
</script>
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 50 total points
ID: 6954332
Where is the setFlag()function?

Fritz the Blank
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6954334
Is that everything in the page?

Provide us with the whole page as there may be errors elsewhere having a knock-on effect.

Ant
0
 
LVL 1

Author Comment

by:tanc02
ID: 6954335
My mistake, I should not have setflag function.
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6954341
Paste this in to a page and you will see it works

<html>
<head>
<script language="javascript">
function tell(){
  alert(document.SomeForm.SomeTextArea.value);
}
</script>
</head>
<body>
<form name="SomeForm">
<p><textarea name="SomeTextArea">hello!</textarea></p>
<p><input type="button" value="click me!" onclick="tell();"></p>
</form>
</body>
</html>

It could be a problem with the setFlag() as fritz mentions.

We really need to see the whole page

:o)

Ant
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6954346
Glad you sorted it.

:o)

Ant
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

810 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