Solved

javascript, how to read value from hidden field

Posted on 2010-11-08
4
378 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
  • 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
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…

773 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