0

I'm trying to link the submit button to open my URL in a new tab but at best I've managed to open an error window. Is the form action the correct way? Thanks

<div class="container">
      <h3>Contact Form</h3>
    ***<form action="_blank><a href="Home.html"></a>***
      <input type="submit" value="Submit"><br>
    </form>
    </div>

3 Answers3

1

You are not appropriately using the action attribute. You have to use _blank in the target attribute and then specify where to send the form-data when the form is submitted in the action attribute. Read more about HTML Form Attributes here.

Your code should look something like this:

<div class="container">
      <h3>Contact Form</h3>
      <form target="_blank" action="/receiveFormData.html"><a href="Home.html"></a>
      <input type="submit" value="Submit"><br>
    </form>
    </div>
Eric Aig
  • 972
  • 1
  • 13
  • 18
0

try this

<button title="button title" class="action primary tocart" onclick=" window.open('http://www.google.com', '_blank'); return false;">Google</button>
AREMU
  • 31
  • 4
0

As the question was already answered by Eric, here I'm just reproducing the same HTML code in the question to be easier to understand

<div class="container">
  <h3>Contact Form</h3>
  <form target="_blank" action="Home.html">
    <input type="submit" value="Submit">
  </form>
</div>

Also, the question has been already answered here

hackick7
  • 9
  • 1
  • 3