Jump to content


onClick used in a form..

  • Please log in to reply
4 replies to this topic

#1 SephirGaine

  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 21 September 2006 - 10:15 PM

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..


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

#2 shadowcaster

  • Members
  • PipPip
  • Member
  • 22 posts
  • LocationUK

Posted 21 September 2006 - 11:24 PM

Are you trying to change a framed page? or open it in a new window?
--Lurking out of sight, Night shall fall and feed my frenzy, Beneath an eerie moon a change comes over me--[br]Check out Symphony X (The oddysey album) if you like heavy metal

#3 snorkler

  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 22 September 2006 - 02:08 AM

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?

#4 SephirGaine

  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 22 September 2006 - 02:18 AM

shadowcaster: Just in the same page will work fine. So preferably, that'll be my route.

snorkler: 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.

#5 fenway

  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 22 September 2006 - 10:14 AM

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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users