Click to See Complete Forum and Search --> : can this VB script be translated into JS?


havey
07-07-2003, 11:05 AM
<%
For Each thing In Request.Form
Response.Write "<input type=""hidden"" name=""" & thing & """ value=""" & Request.Form(thing) & """>" & vbCrLf
Next
%>

pyro
07-07-2003, 11:45 AM
I don't know any VB at all, so if you post what it is supposed to do (or rather, what you want to do in javascript) those of us who don't know VB can also help you.

Khalid Ali
07-07-2003, 11:50 AM
The only problem in this is that JavaScript does not have any HttpRequest or HttpResponse objects,however if want create form fields dynamically yes that is possible

havey
07-07-2003, 11:54 AM
what it does is take each all that is selected on a form and trun it into a <hidden> field in the html with its name and value, you could place this script on any page to pass all the hiddens to the next form and place it on that form to pass the accumlative hiddens to the next form and so on, the last page will contain all the created hiddens from all previous forms. basically i can't use cookies or session variables only the url and the forms are below. I'm would like to pass the variable and its value across every page and write them on the last page. The VB script automatically passes all variables in a form to the next form and you place the script in the next form to pass to the next and so on... now i think i'm rambling on... anyway i was hoping that there was a JS alternative to this dynamic hidden creation script.

like so:

form1:

<html>
<head>
<title>age</title>
</head>
<body>

<form>
<p>age10<input type="radio" value="10" checked name="age"></p>
<p>age5<input type="radio" name="age" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form2:

<html>
<head>
<title>ada</title>
</head>
<body>

<form>
<p>ada10<input type="radio" value="10" checked name="ada"></p>
<p>ada5<input type="radio" name="ada" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form3:

<html>
<head>
<title>edu</title>
</head>
<body>

<form>
<p>edu10<input type="radio" value="10" checked name="edu"></p>
<p>edu5<input type="radio" name="edu" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form4:

<html>
<head>
<title>gua</title>
</head>
<body>

<form>
<p>gua10<input type="radio" value="10" checked name="gua"></p>
<p>gua5<input type="radio" name="gua" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form5:

<html>
<head>
<title>lan</title>
</head>
<body>

<form>
<p>lan10<input type="radio" value="10" checked name="lan"></p>
<p>lan5<input type="radio" name="lan" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form6:

<html>
<head>
<title>occ</title>
</head>
<body>

<form>
<p>occ10<input type="radio" value="10" checked name="occ"></p>
<p>occ5<input type="radio" name="occ" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form7:

<html>
<head>
<title>reg</title>
</head>
<body>

<form>
<p>reg10<input type="radio" value="10" checked name="reg"></p>
<p>reg5<input type="radio" name="reg" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form8:

<html>
<head>
<title>wor</title>
</head>
<body>

<form>
<p>wor10<input type="radio" value="10" checked name="wor"></p>
<p>wor5<input type="radio" name="wor" value="5"></p>
<p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
</form>

</body>
</html>

form9:
displayes values from forms 1 - 8