Submit to one of two locations?
Hi
I'm trying to find out if there is a way to have a form submit itself to the current page within the existing window, and (the tricky part) submit to a brand new window if a different button is pushed.
Thanks!
Peter
Touchup image processing applet
Pixel Development Web Design, Photography
Renegade posted this at 10:25 — 13th August 2004.
He has: 3,022 posts
Joined: Oct 2002
One way I can think of would be to have the form submit to one page and you pass another hidden variable along with it. The page then checks which button was used to submit and redirects accordingly. Do you get what I mean?
pmj7 posted this at 12:35 — 13th August 2004.
He has: 234 posts
Joined: Nov 2002
Hi Cheng
Thanks for the suggestion. I though of another way to do it when I woke up this morning. A second form could be created on the page, with no fields. When the alternate submit button is pressed, the fields from one form could be copied via JavaScript to the other, and voila.
Peter
Touchup image processing applet
Pixel Development Web Design, Photography
andy206uk posted this at 12:41 — 13th August 2004.
He has: 1,758 posts
Joined: Jul 2002
You would be much better doing it client side using PHP, ASP or CGI
Remember, around 12% of internet users have javascript disabled, so they wouldn't be able to use your site without it. You never have that problem when using server side solutions (well... apart from when using cookies, but that's an alltogether different kettle of fish).
What I don't get is why you need to open a new window at all? this can be very confusing for the user if you start opening popups all over the shop. I'm sure there's a way of doing what you need without using a second window.
Andy
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.