Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

javascript, how to read value from hidden field

Posted on 2010-11-08
4
Medium Priority
?
390 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 400 total points
ID: 34088101
document.getElementById("myhiddenfield")
0
 
LVL 18

Accepted Solution

by:
Sudaraka Wijesinghe earned 600 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
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…

704 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