Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Override form submit on button press

Status
Not open for further replies.

thrybergh

MIS
Feb 10, 2003
52
GB
Hello.

I've got a sign-in page with a form and three buttons. One is to submit the user/password, one is to send the forgotten password to the user and the other is to take the user to a registration page if they are a new user.

I have used CSS to make the buttons look the same, but I want the "register" button to simply navigate to a new page in the current browser window, and not submit the form. Can I stop the form being submitted with javascript?

Thanks.
 
Unless you've specifically created the &quot;register&quot; button as a <input type=&quot;submit&quot;> it will not submit the form.

You can make the button like so:

<a href=&quot;address for your page to navigate to&quot;><input type=&quot;button&quot; value=&quot;Register&quot;></a>

If this isn't what you're looking for, you might provide a little more information.

Good luck.
 
or:

<input type=&quot;button&quot; value=&quot;regester&quot; onclick=&quot;window.location.href='regester.asp'&quot; />

where 'regester.asp' is the page you want them to go to.
 
Thanks guys. That's what I needed to do.

I'd forgotten that I could have my input attribute as a simple &quot;button&quot;.

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top