View Full Version : Hidden form variables
07-17-2003, 06:40 AM
Could someone look at this tutorial and tell me how to change the output to the second page so the values are put into hidden form fields? The example we are intereste in using is the Location.search property. We want to pass the form variables to a new page which will have the variables hidden in a new form.
Here's the URL:
07-17-2003, 07:17 AM
the code is still the same.
you just make the field hidden, instead of type text.
<input type="hidden" NAME="MyValue" SIZE="12" VALUE="HELLO">
<input type="hidden" NAME="MyTest" SIZE="15">
if the type attribute is not present in the <input> tag, the default type is text which is a normal textbox.
07-17-2003, 03:29 PM
Thanks for replying Glenn.
I tried that before, changing the type to hidden. But it does not actually place the hidden variable on the page.
If I look at the page source, they are not there, but if I look at the page info, or page properties in IE, they do show up.
How can I get the variables to actually show in the source, or does it really matter when I go to use the hidden variables in the next operation by submitting the form on page 2?
Maybe PHP would be better for this?
07-17-2003, 06:11 PM
alert("The value of my hidden field is "+ myform.myfield.value +" but the HTML didn\'t change");
<form onsubmit="return hidden_value(this);">
<input type="hidden" name="myfield">
07-17-2003, 06:20 PM
I did some testing and it does work!
It will even pass the values to a different server or domain, which is what we need.
Even though the values don't show in the source HTML, they are passed to the new page or form.
Thanks for the input!
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.