Click to See Complete Forum and Search --> : pass variable value in hidden tags


catchup
07-02-2003, 11:39 PM
is it possible to pass a variable value as hidden.. something like:

<input type="hidden" name="data" value="javascript:+name">

Khalid Ali
07-02-2003, 11:44 PM
I am thinking this will do what you are trying to do

value="this.value = name"
did not try it..just seems like it will work

catchup
07-02-2003, 11:55 PM
no luck, thanks though, maybe i'll try something else....
Problem: the alert properly display the "data" value but the "data" value won't add to the end of the URL?
hmm... any ideas?

var sum = parseInt(document.f1.age[j].value)
var data = ",(age="+sum+")";
document.f1.action="Education.htm?age="+sum+data;
alert (data)

the alert displays: ,(age="10") ///using 10 as a numeric form option value example

the url displays only: Education.htm?age=10

why doesn't the url display: Education.htm?age=10,(age="10")

Khalid Ali
07-03-2003, 12:18 AM
You can use onload event of the body tag or any other event triggered by any button and set the value of the hidden field to whatever varaible you want..

document.formName.fieldName.value = variable;

catchup
07-04-2003, 11:05 PM
Whats the problem here....... i have this:
<html><head>

var sum = parseInt(document.f1.age[j].value)
var data = ",(age="+sum+")";
document.f1.data.value=data;
document.f1.action="Education.htm?age="+sum;

</head>


<body>
<input type="hidden" name="data"/>
</body>
</html>

after the form submits, the Education.htm url is:
Education.htm?age=10&data=%2C%28age%3D10%29

and I can't find the hidden variable and value, when i view the source?

How can i have after form submits url (education.htm's url)just:
Education.htm?age=10

and in the source of Education.htm have a hidden tag displaying the name "data" and value of data