表单多提交按钮跳转不同页面问题:店主注册按钮跳转新HTML页面实现方案咨询
Hey there, let's fix that Shop Owner signup button redirect issue you're facing! The core problem here is your button is set as a type="submit" element — this triggers the form's default submission behavior, which overrides any link action you try to add. Here are three reliable solutions to get it working smoothly:
解决方案1:修改按钮类型并包裹在<a>标签中
Change the button's type from submit to button (so it won't trigger form submission), then wrap it in an <a> tag pointing to your target page:
<div class="mrgn-30-top"> <a href="your-shop-owner-signup-page.html"> <button type="button" class="btn btn-larger btn-block"> Sign up as Shop Owner </button> </a> </div>
This way, clicking the button will trigger the link's redirect instead of trying to submit the form.
解决方案2:添加点击事件阻止表单提交并跳转
If you prefer keeping the submit type, add an onclick handler to stop the default form behavior and force a redirect:
<div class="mrgn-30-top"> <button type="submit" class="btn btn-larger btn-block" onclick="event.preventDefault(); window.location.href='your-shop-owner-signup-page.html';"> Sign up as Shop Owner </button> </div>
event.preventDefault()stops the form from submittingwindow.location.hrefsends the user to your desired signup page
解决方案3:替换为样式化的<a>标签
Bootstrap's btn classes work perfectly on <a> tags — you can ditch the button entirely and use a styled link instead:
<div class="mrgn-30-top"> <a href="your-shop-owner-signup-page.html" class="btn btn-larger btn-block"> Sign up as Shop Owner </a> </div>
This maintains the button's visual style while acting as a normal link, with zero form submission interference.
内容的提问来源于stack exchange,提问作者Fardin Jim

