473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Access JSP hidden Variable in Script

Hi,

Could someone help me how to access a JSP hidden variable in Java Script?

Here is my code:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. var mnuItems = ["../../jsp/actions/items.do?action=itemAction&itemId=hdnItem]
  3. </script>
  4.  
  5. <input type=hidden id="hdnItem" name = "hdnItem" value="A565CG"
  6.  
  7.  
I would like to know how to access a hidden variable hdnItem in java script variable.

Thanks
Sep 30 '07 #1
4 7518
Dököll
2,364 Expert 2GB
You got me there brother, here's a discussion on something similar:
[removed link]

And here:

[removed link]
Dec 24 '08 #2
JosAH
11,448 Expert 8TB
This is a Javascript question so I've moved the thread.

kind regards,

Jos (moderator)
Dec 24 '08 #3
acoder
16,027 Expert Mod 8TB
In this case, you'd access the hidden form value using:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("hdnItem").value
Just make sure it's after page load, otherwise the element will be undefined.

Having said that, you could just use JSP to generate the required JavaScript.
Dec 24 '08 #4
After running the page on server it will get converted in HTML right click and view source look at the Id of the hidden field which you want to use.Now with the same Id use it in the javascript programming .If you face any problem post it .
Dec 27 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jon | last post by:
Hi all, I am trying to create a page that contains a number of div elements, with links on the left side of the page allowing the user to select which div to display. Some of the pages contain...
0
by: TheCoder | last post by:
I am making a D-base with web conectivity for my class project. I have everything working but the subit button sends the data to the correct fields but afterwards it wants to reproduce new blank...
4
by: Ian Cox | last post by:
I have a web form that contains a Datagrid. This grid has a number of columns, one of which contains a text box and validator for that text box. Everything works fine, when I press the "Save"...
2
by: P K | last post by:
I am using server.transfer for a website being developed in vs.net 2005 And I need to get the posted values after server.transfer. For this I set the second parameter "true" in the transfer...
1
by: Evan Kontos | last post by:
I have the need to test for the value of a client variable from a server control in a VB Web form. How can I do this in VB. Net? Evan Kontos | EKontos@comtekcadd.com 27 Whitehall St. | ...
5
by: pbd22 | last post by:
Hi. I am trying to poll a long-running process via a hidden IFrame. I am noticing that the online errata gives advice for handling a server response: window.parent.handleServerResponse(); ...
4
by: akshay01 | last post by:
Hi All, I am using the following code in which i am creating some textboxes and and as the for loop continues the name of the textboxes will also be unique for all the textboxes. now i want to...
4
by: Harry | last post by:
Hi Guys I dont really know how to do this: if there are a page of others, some data are embedded inside the data array like this: <script language="JavaScript" type="text/javascript"> <!-- var...
1
by: asp beginner | last post by:
I am building an Eccomerce site and I am trying to make my shopping cart work. I am having a problem with when I have entered data into my form it is not submitting into my access database. This my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.