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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change hidden fields value using asp

Status
Not open for further replies.

sasa888

Programmer
Oct 15, 2001
131
0
0
US
Is it possible to change the value of hiddle fields at run time using asp?
 
Do you mean hidden fields within a web page form? You can assign the value of hidden fields dynamically when the page is loaded via ASP. Once the page is loaded, it would need to be reloaded/form submitted in order to change the value again.

example:

<input type=&quot;hidden&quot; name=&quot;field1&quot; value=&quot;<%=ASP_value%>&quot;>

Hope that's what you're looking for.
 
Thanks for your response, in the <%=ASP_value%>, do I put like response.querystring(&quot;field_name&quot;)?
 
yeah, but it'll be request.querystring. You could use any ASP variable, string, recordset item etc. In such a case, the &quot;=&quot; sign is a short cut for &quot;response.write&quot;

For example:

<input type=&quot;hidden&quot; name=&quot;field1&quot; value=&quot;<%=request.querystring(&quot;field_name&quot;)%>&quot;>
 
Thank you for your response. Can I place <input type=&quot;hidden&quot; name=&quot;field1&quot; value=&quot;<%=request.querystring(&quot;field_name&quot;)%>&quot;> anywhere in the code? or there is a specific area that I need to put in. It is not changing the hidden field value for me.... :( Please help.
 
has the querystirng been submitted top the page?

what you ahve is fine and yes you can write the querystring anywhere as long as per say &quot;field_name&quot; was submitted or manipulated into the URL prior to this call

____________________________________________________
[sub]Python????? The other programming language you never thought of!
thread333-584700[/sub]
onpnt2.gif
 
Can I put <input type=&quot;hidden&quot; name=&quot;field1&quot; value=&quot;<%=request.querystring(&quot;field_name&quot;)%>&quot;> in a confirmation page?

like...

<body>

<form method=&quot;GET&quot; action=&quot;/scripts/Test.asp&quot;>
<p style=&quot;word-spacing: 1; margin-left: 45; margin-top: 1; margin-bottom: 1&quot; align=&quot;left&quot;><font size=&quot;2&quot;><b><font color=&quot;#000080&quot;>Submitter
Name:</font></b> <!--webbot bot=&quot;ConfirmationField&quot; s-field=&quot;FromName&quot; --></font></p>
<p style=&quot;word-spacing: 1; margin-left: 45; margin-top: 1; margin-bottom: 1&quot;><font size=&quot;2&quot;><b><font color=&quot;#000080&quot;>Submitter
Email Address:</font></b> <!--webbot bot=&quot;ConfirmationField&quot;
s-field=&quot;FromEmailAddress1&quot; --></font></p>
 
Yep, just need to be within the <FORM> ...</FORM> tags.

Forinstance if you had

<form method=&quot;GET&quot; action=&quot;/scripts/Test.asp&quot;>

<input type=&quot;hidden&quot; name=&quot;field1&quot; value=&quot;<%=request.querystring(&quot;field_name&quot;)%>&quot;>

</form>

and

further down..

<form method=&quot;GET&quot; action=&quot;/scripts/Test2.asp&quot;>

<input type=&quot;submit&quot; name=&quot;GOGO&quot; >

</form>

If you now clicked on Submit and it takes you to Test2.asp, you would have a problem as your hidden field applies to a different field.

This is a pretty tricky area, just make sure your fields are in the <FORM> </FORM> tags.

cheers


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top