Solved

How do I read textarea value ?

Posted on 2002-04-19
8
2,370 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
Comment Utility
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
Comment Utility
but I got object required error.
0
 
LVL 1

Author Comment

by:tanc02
Comment Utility
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
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 50 total points
Comment Utility
Where is the setFlag()function?

Fritz the Blank
0
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

 
LVL 15

Expert Comment

by:a.marsh
Comment Utility
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
Comment Utility
My mistake, I should not have setflag function.
0
 
LVL 15

Expert Comment

by:a.marsh
Comment Utility
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
Comment Utility
Glad you sorted it.

:o)

Ant
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

762 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

9 Experts available now in Live!

Get 1:1 Help Now