I have a webpage with three buttons, two of the buttons action the form submitting data to the server, it then sends back the appropriate page. The third button is meant to just open a new webpage in a new tab, the current page does not need to be reloaded so this button is just a button element with some onclick() code, its is not part of an input element
The trouble is that when I click on the third button it actions the form action the form even though its not an input type, why does it do this ?
<main> <form action="/license.process" name="process" id="process" method="post"> <label> Please enter your license information as provided in your license email </label> <table> <tr> <td><label title="Email">Email</label></td><td><input type="text" name="licenseEmail" value="[email protected]" class="licenseinputfield"></td> </tr> <tr> <td> <label title="License Key 1"> License Key 1 </label> </td> <td> <input type="text" name="licenseKey1" value="50302c02147f23ed809a8f2579338121a2b1594f967bb18" class="licenseinputfield"> </td> </tr> <tr> <td> <label title="License Key 2"> License Key 2 </label> </td> <td> <input type="text" name="licenseKey2" value="0ff02146cd1777d7e0890e659b10218761869212d7b0d60" class="licenseinputfield"> </td> </tr> </table> <input type="submit" name="cancel" value="Cancel"> <input type="submit" name="save" value="Save"> <button onclick="window.open('http://www.jthink.net/songkong/buy.jsp','_blank');"> Get License </button> </form> </main> I can make it work properly by moving this third button outside of the form. But then I get formatting problem because button is shown on next line, regardless I want to understand why having the butto within the form triggers the form.