View Full Version : Forms and URL's

08-03-2002, 12:41 PM

I need to make a form automatically put in the URL of the page
its being sent from. I am trying to eliminate the requests for page 404 and the page I've made requests users to send the addr, to help the URL needs to be filled in.

I know I have to use window.location and make a hidden
input type but I do not know how to assign the addr to the form field.



08-03-2002, 05:20 PM
If you have a hidden form field called "url" reserved for this functionality, you can use this in the <form> tag of your form:

onsubmit="this.url.value = location.href;"

Though I don't understand why you don't write the URL directly into the hidden form field, that would also suit users who have JS disabled.