Solved

javascript, how to read value from hidden field

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

739 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