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

Using referrer in a form to assign a hidden value

Status
Not open for further replies.

tennis

Technical User
Aug 23, 2001
18
US
Hi;

I have a form in an html document with a hidden field. I would like to assign that field(referring_page) the value of the referring document. The form emails the different field values back to the customer.

Here is the non-working code I have so far:


<script language=&quot;Javascript&quot;>
function GETURL(waterform)
{
if (document.referrer&&document.referrer!=&quot;&quot;)
document.waterform.referring_page.value=(''+document.referrer+'<BR>');
}
//-->
</script>

...

<FORM METHOD=POST ACTION=&quot;/cgi-bin/mail.cgi&quot; NAME=&quot;waterform&quot;>
...

<td valign=&quot;top&quot;><INPUT NAME=&quot;c_WasItFound?&quot; SIZE=&quot;12&quot;></td></tr>
<td valign=&quot;top&quot;>Your mailing address:</td>
<td valign=&quot;top&quot;><TEXTAREA NAME=&quot;h_address&quot; COLS=40 ROWS=&quot;10&quot;></TEXTAREA></td></
tr>
<td valign=&quot;top&quot;></td>
<td valign=&quot;top&quot; align=&quot;center&quot;></td>
<td valign=&quot;top&quot;><INPUT TYPE=&quot;hidden&quot; VALUE=&quot; &quot; NAME=&quot;referring_page&quot;>

<INPUT TYPE=submit VALUE=&quot;Send comments&quot; onsubmit=&quot;GETURL(waterform);&quot; >
...
</table>
</FORM>

Thanks,

 
hi
try document.forms.waterform.referring_page.value=''+document.referrer+'';
Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top