Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to dynamically add form elements and use them in a new page? 1

Status
Not open for further replies.

eurob

Programmer
Jan 25, 2004
13
US
I have one form and on the submit event I would like to add a hidden field and use it in the next page with the new value I assign to the value used in the input field.
The problem is that even though I assign the value, it is not contained in the form after the submit.

Any idea ?

page1.asp
------------------------------------------------------
<form method = &quot;post&quot; name=&quot;tekst&quot; onsubmit=&quot;test()&quot;>
<input type = &quot;submit&quot; value = &quot;submit&quot;>
</form>

<script language=&quot;vbscript&quot;>
sub test()
bla=&quot;values&quot;
tekst.innerhtml = tekst.innerhtml & &quot; <input type=hidden
name='bla' value=&quot; & bla
document.tekst.action=&quot;test.asp&quot;
document.tekst.submit()
end sub
</script>


page2.asp
-----------------------------------------------------
<%
z=request.form(&quot;bla&quot;)
response.write z
%>



 
Why not have the hidden field already in the form, and changing this value in the onsubmit event ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
That worked ;o)
Thanx a lot

robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top