Sample with some fixes
by Ron Eaglin
HTML
<div class="navbar">
<a href="index.html">Home</a>
<div class="dropdown">
<button class="dropbtn">My Classes
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<a href=datacommunications.html>Data and Computer Communications</a>
<a href=systemsint.html>Systems Integration</a>
<a href=voiceanddata.html>Voice and Data Network Design</a>
<a href= http://roneaglin.online/cop4813>Web Systems</a>
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Assignments
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<a href=http://roneaglin.online/cop4813/home/assignments/assignment-1/>Assignment 1</a>
<a href=http://roneaglin.online/cop4813/home/assignments/assignment-2/>Assignment 2</a>
<a href=http://roneaglin.online/cop4813/home/assignments/assignment-3/>Assignment 3</a>
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Favorite Sites
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<a href=https://mechanicalkeyboards.com/>Mechanical Keyboards</a>
<a href=https://www.reddit.com/r/Eyebleach/>Eyebleach</a>
<a href=https://pcpartpicker.com/>PCPartpicker</a>
</div>
</div>
</div>
<form name="inputform" onsubmit="return ValidateForm();" method="post" action="mailto:[email protected]">
Full name:
<input type="text" name="fullname" placeholder="Full Name" ><br>
Birthday:
<input type="date" name="birthday" ><br>
Address:<br>
<textarea name="address" rows="4" col="8" placeholder="Enter Your Address" ></textarea><br>
E-mail:
<input type="email" name="email" placeholder="Email Address" ><br>
Telephone:
<input type="tel" name="phone" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" placeholder="123-456-7890" ><br>
Message:<br>
<textarea rows="4" name="message" form="usrform" placeholder="Enter a message" >
</textarea><br>
...
JavaScript
function ValidateForm()
{
var fullname = document.forms["inputform"]["fullname"].value;
if (!ValidateNotBlank(fullname, 'Full Name' )) return false;
var birthday = document.forms['inputForm']['birthday'].value;
if (!ValidateNotBlank(birthday, “Date” )) return false;
if (!ValidateDate()) return false;
var address = document.forms["inputform"]["address"].value;
if (!ValidateNotBlank(address, "Address” )) return false;
var email = document.forms["inputform"]["email"].value;
if (!ValidateNotBlank(email, “Email Address” )) return false;
var phone = document.forms["inputform"]["phone"].value;
if (!ValidateNotBlank(phone, “Phone Number” )) return false;
var Message = document.forms["inputform"]["message"].value;
if (!ValidateNotBlank(message, “Message” )) return false;
return true;
}
function ValidateNotBlank(val, message)
{
if (val == null || val == “”)
{
alert("Must enter a value for" + message);
return false;
}
return true;
}
function ValidateDate()
{
var d = document.forms[“inputForm”][“birthday”].value;
var d_as_date = Date.parse(d);
var today = new Date();
if (d_as_date > today)
{
alert(“The date entered is after today”);
return false;
}
return true;
}