JSFiddle - React, Tailwind, and code Playground
by akang2
HTML
<form method="post" name="myemailform" action="http://jsfiddle.net/akang2/VbHHc/2/">
<p><label for="attendeeName"><br />
Name of attendee</label>
<br />
<input type="text" name="attendee" id="attendee" />
</p>
<p><label for="name"><br />
Name of guest(s)</label>
<br />
<input type="text" name="guestname" id="guestname" />
</p>
<p>
<label for="spcamburi">Need transfer from SP to Camburi</label>
<input type="radio" name="attendancea" value="Yes" /> Yes<br />
<input type="radio" name="attendancea" value="No" /> No<br /><br />
<label for="spcamburi">Need transfer from Camburi to SP</label>
<input type="radio" name="attendanceb" value="Yes" /> Yes<br />
<input type="radio" name="attendanceb" value="No" /> No<br />
</p>
<p>
<label for="adults:"><br />
Number of adults:</label>
<br />
<select name="numadults" id="numadults">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</p>
<p>
<label for="Number of children:"><br />
Number of children:</label>
<br />
<select name="numkids" id="numkids">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</p><br />
<p><label for="Email:"><br />
Email:</label>
<br />
<input type="text" name="email" id="email" />
</p>
<p>
<label for="Telephone:"><br />
...
CSS
input {
color: #499;
}
JavaScript
//form submission practice
//grab the email field
var emailField = document.getElementById("email");
//the emailValidation function
//grab the submit button
var submitButton = document.getElementById("submit");
//event handler for submission
function emailValidation() {
submitButton.onsubmit = function() {
if (emailField.value == "") {
document.getElementById("errorMess").innerHTML = "FUCK THAT";
return false;
}
else {
return true;
}
};
}
//Form submission practice
window.onload = function() {
emailValidation();
};