Solved

javascript, how to read value from hidden field

Posted on 2010-11-08
4
388 Views
Last Modified: 2012-06-21
Suppose i have two forms (A and no name).  In javascript, how do I get to the hidden field value in formA and formwith no name.

<form name="formA" action="dosomething" method="post">
  <input type="hidden" name="fieldA" value="AAAA">
  <input type="submit" value="Submit" />
</form>
<form action="dosomething" method="post">
  <input type="hidden" name="fieldB" value="BBBB">
  <input type="submit" value="Submit" />
</form>
0
Comment
Question by:rgbcof
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Assisted Solution

by:jafrazee
jafrazee earned 100 total points
ID: 34088101
document.getElementById("myhiddenfield")
0
 
LVL 18

Accepted Solution

by:
Sudaraka Wijesinghe earned 150 total points
ID: 34088279

var fieldA_value=document.getElementsByName('fieldA')[0].value;;
var fieldB_value=document.getElementsByName('fieldB')[0].value;;

Open in new window

0
 

Author Closing Comment

by:rgbcof
ID: 34088728
Both solutions works.  Thanks for the specifics Sud.
0
 
LVL 18

Expert Comment

by:Sudaraka Wijesinghe
ID: 34090287
Glad to help. Thanks for the points.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

623 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