JSFiddle - React, Tailwind, and code Playground
HTML
<form name = "OrderForm" action = "process_order.php" onsubmit = "return CheckForm()" method = "post">
<input type="text" id="Name"/>
<input type="submit"/>
</form>
<script>
function CheckForm() {
var Name = document.getElementById("Name");
var bool = true;
if ((Name.value == "" )) {
bool = false;
}
else if (!(fryyes || fryno)) {
bool = false;
}
if (!(bool)) {
alert("Please fill out all of the required fields.");
return false;
}
else {
alert("Your order is being submitted");
console.log("Submitted")
}
};
</script>