Jump to content

Archived

This topic is now archived and is closed to further replies.

SephirGaine

onClick used in a form..

Recommended Posts

Hey ya'll.  Basically, I want to have two submit buttons, each going to a different page. I figure I'll lead one like normal, and have it go to my action="" page.

But, my second one I want to go to a seperate page. I understand that Javascript works for this using the onClick tag, but I haven't been able to get it working. So far..

[code]onClick="parent.location='closelead.php'[/code]

That's what I'm working with. Any help would be appreciated.

Share this post


Link to post
Share on other sites
How about leading the action to the same page, and then using a switch function on that page to insert the relevant script/s based upon the value of the Submit buttons?

Share this post


Link to post
Share on other sites
[b]shadowcaster[/b]: Just in the same page will work fine. So preferably, that'll be my route.

[b]snorkler[/b]: That was an idea that came to mind, but it seems to be a lot more work than deems necessary. If there's a way to basically have 2 submit buttons on a single form, each leading to different pages, that'll save me time, effort, and probably a bit of frustration to do it that way. If this falls through that's what I'll do however.

Share this post


Link to post
Share on other sites
You can have 2 submit buttons... but only one action per form, unless you want to play very silly JS games.  Alternatively, you can have the server-side script perform the necessary redirects if applicable.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.