Skip to content
Advertisement

Link inside form referring to the action of the form instead of the link

I am trying to make the link inside the form go to signup2.php. Instead it is going to loginprocess.php. Is there any way to do this by keeping the signup link inside the form?

JavaScript

Advertisement

Answer

Buttons inside forms are automatically treated as submit buttons as is apparent in this post. If you want to alter this functionality, there are a few options.

  • Remove the button from the form altogether; the link will suffice if you are doing class-based styling
  • Override the default form-button behaviour by changing the button type
JavaScript
  • You can choose which buttons submit the form using Javascript:
    • Change the form onsubmit value
    • Manually submit the form by targeting the submit button
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement