'how do i make a submit button link to another page but i have required attribute

Hello so I have a problem with submit button leading to another page. I figured it out how to make it go to another page but it doesn't recognize the required attribute.

Does anyone have any ideas ?

Html

<input type="submit" form="product_form" id="searchsubmit" onclick="myFunction()">
<form action="welcome.php" method="post" id="product_form">
<label>SKU</label> <input type="text" name="sku" class="sku" required>
</form>

JS

function myFunction() {
    window.location.href = "index.html";
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source