By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,420 Members | 1,219 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,420 IT Pros & Developers. It's quick & easy.

How to translate a javascript variable to be a hidden html variable

P: 110
I have a web application that relies on CGI pages to manipulate data captured and displayed in a series of html pages. On one of those pages I display comparative quotes and use javascript to activate buttons to make selections between the quotes. Specifically, Option 1 contains the values for quote 1 and Option 2 contains the values for quote 2. When the user presses a button the comparative quote display is replaced by the option the user has selected. My problem is that I need to convert the choice of Option1 or Option 2 to be a hidden html variable that I can pass to the next CGI applet. How can I do this?
Feb 20 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
Put a hidden form field in your html:
[HTML]<input type="hidden" id="somehidden" name="somehidden" value="">[/HTML] and then just set the value to the quote value when you click the button:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("somehidden").value=quoteval;
When you submit the form, the value will be passed to your CGI script.
Feb 21 '07 #2

Post your reply

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