[WEB4LIB] How to submit form and forward user to another page

Chris Gray cpgray at library.uwaterloo.ca
Wed Feb 24 12:49:01 EST 1999


You can't really do what you're trying to do with just HTML and JavaScript.

The "Submit" button sends the information to a server-side script for
processing and at that point it is out of the hands of the browser until
the server-side script returns a result.

Usually the server-side script returns a new page of some sort (a thank you
message, a display of the information submitted, the results of a search),
so if you want to control that page you have to know how to rewrite or
configure the server-side script.

You can use JavaScript to go to a new page with the location.replace()
method activated by a button, but that bypasses submission of the form data
even if you mix that with a form.submit() method in your script.

The best you might do is two buttons: one on the form to submit the data,
one on the page returned by the server-side script that uses the
location.replace() method to go on to a new page.

Hope this answers you question.

Chris Gray
Library Systems Technician
University of Waterloo

At 02:49 PM 1999-02-22 -0800, Donald Barclay wrote:
>Does anyone know of a more-or-less simple way to set up a web form so that
>when users fill out the form and click the "Submit" button they are
>automatically sent to some other webpage?
>
>This question was asked a few months ago on Web4Lib with no satisfactory
>answer provided. (I checked the archives.) I've looked all through the
>website on HTML and Java script with no luck either. I'm either not looking
>for the right terms or this is harder than it seems.
>
>Thanks for any help.
>
>Donald A. Barclay
>Houston Academy of Medicine-       always the beautiful answer
>Texas Medical Center Library           who asks the more beautiful question
>donaldb at library.tmc.edu                                   -- e. e. cummings
>
>
>


More information about the Web4lib mailing list