Change form location depending on submit button?

He has: 1,758 posts

Joined: Jul 2002

Hey guys,

I hate using Javascript for this kind of stuff but I can't think of a simple solution without client side technology. Basically, I'm working on a form that after it's filled in has two options. One to generate a preview and the other to submit the details (similar to the post page on this forum actually!).

I was wondering if it's easy to change the form location depending on which of the two buttons at the bottom is pressed and if so how I would go about doing it?

Thanks for the help guys!

Andy

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

<input type="submit" onClick="document.form1.action='http://www.somewhere.com';">
'

That should do it.

He has: 1,758 posts

Joined: Jul 2002

Thanks! That worked a treat = I've really got to learn Javascript... it's one of those things I've always avoided!

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.