Bruce Gust
asked on
Why am I being told I need another semicolon?
Here's my code:
['code]<html>
<head>
<title>Health Summary</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
body {
font-family: Arial, Helvetica;
font-size:12pt;
}
.button-verify {
width:150px;
background-color:#000000;
border-radius:10pt;
padding:10px;
text-align:center;
box-shadow:10px 10px 5px #cccccc;
height:25px;
color:#ffffff;
}
</style>
<script>
$(document).ready(function () {
function isValidDate(dateString) {
// First check for the pattern
if (!/^\d{1,2}\/\d{1,2}\/\d{4 }$/.test(d ateString) )
return false;
// Parse the date parts to integers
var parts = dateString.split("/");
var day = parseInt(parts[1], 10);
var month = parseInt(parts[0], 10);
var year = parseInt(parts[2], 10);
// Check the ranges of month and year
if (year < 1000 || year > 3000 || month == 0 || month > 12)
return false;
var monthLength = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
// Adjust for leap years
if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0))
monthLength[1] = 29;
// Check the range of the day
return day > 0 && day <= monthLength[month - 1];
};
function isInt(value) {
return !isNaN(parseInt(value, 10))
&& (parseFloat(value, 10) == parseInt(value, 10));
}
function validateForm() {
var dob = document.getElementById("u srDOB");
var ssn = document.getElementById("u srSSN");
var error = '';
if (!isValidDate(dob.value))
{
$('#usrDOB').css('border', 'solid 2px red').focus();
error = "Date of Birth must be in the format XX/XX/XXXX\n\r";
}
else
{
$('#usrDOB').css('border', '');
}
if (!isInt(ssn.value))
{
$('#usrSSN').css('border', 'solid 2px red').focus();
error = error.concat("Member ID must be numeric\n\r");
}
if (error.length > 0)
{
alert(error);
return false;
}
return true;
}
$('#findPortalUser').click (function( event){
event.preventDefault();
var dob:$('#usrDOB').val();
});
});
</script>
</head>
<body>
<form method="post" id="step_1" name="loginForm" onsubmit="return validateForm()">
<h4>Start:</h4>
<p>Please provide your Date of Birth and Social Security Number (last four).</p>
<div>
<div class="label">Date of Birth:</div>
<div class="input">
<input type="text" name="usrDOB" id="usrDOB" class="dob" placeholder="mm/dd/yyyy">
</div>
<br />
<div class="label"> SSN (last four):</div>
<div class="input">
<input type="tel" name="usrSSN" id="usrSSN" placeholder="9999">
</div>
</div>
<br /><br />
<div style="text-align: center; width:25%; margin:0 auto;">
<a class="button-verify" id="findPortalUser">Verify </a>
</div>
</form>
</body>
</html>[/code]
I'm just trying to understand some things about JQuery and in the midst of puttering around, I'm getting an error that says "Expected ';'" on line 89.
Why?
['code]<html>
<head>
<title>Health Summary</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
body {
font-family: Arial, Helvetica;
font-size:12pt;
}
.button-verify {
width:150px;
background-color:#000000;
border-radius:10pt;
padding:10px;
text-align:center;
box-shadow:10px 10px 5px #cccccc;
height:25px;
color:#ffffff;
}
</style>
<script>
$(document).ready(function
function isValidDate(dateString) {
// First check for the pattern
if (!/^\d{1,2}\/\d{1,2}\/\d{4
return false;
// Parse the date parts to integers
var parts = dateString.split("/");
var day = parseInt(parts[1], 10);
var month = parseInt(parts[0], 10);
var year = parseInt(parts[2], 10);
// Check the ranges of month and year
if (year < 1000 || year > 3000 || month == 0 || month > 12)
return false;
var monthLength = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
// Adjust for leap years
if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0))
monthLength[1] = 29;
// Check the range of the day
return day > 0 && day <= monthLength[month - 1];
};
function isInt(value) {
return !isNaN(parseInt(value, 10))
&& (parseFloat(value, 10) == parseInt(value, 10));
}
function validateForm() {
var dob = document.getElementById("u
var ssn = document.getElementById("u
var error = '';
if (!isValidDate(dob.value))
{
$('#usrDOB').css('border',
error = "Date of Birth must be in the format XX/XX/XXXX\n\r";
}
else
{
$('#usrDOB').css('border',
}
if (!isInt(ssn.value))
{
$('#usrSSN').css('border',
error = error.concat("Member ID must be numeric\n\r");
}
if (error.length > 0)
{
alert(error);
return false;
}
return true;
}
$('#findPortalUser').click
event.preventDefault();
var dob:$('#usrDOB').val();
});
});
</script>
</head>
<body>
<form method="post" id="step_1" name="loginForm" onsubmit="return validateForm()">
<h4>Start:</h4>
<p>Please provide your Date of Birth and Social Security Number (last four).</p>
<div>
<div class="label">Date of Birth:</div>
<div class="input">
<input type="text" name="usrDOB" id="usrDOB" class="dob" placeholder="mm/dd/yyyy">
</div>
<br />
<div class="label"> SSN (last four):</div>
<div class="input">
<input type="tel" name="usrSSN" id="usrSSN" placeholder="9999">
</div>
</div>
<br /><br />
<div style="text-align: center; width:25%; margin:0 auto;">
<a class="button-verify" id="findPortalUser">Verify
</div>
</form>
</body>
</html>[/code]
I'm just trying to understand some things about JQuery and in the midst of puttering around, I'm getting an error that says "Expected ';'" on line 89.
Why?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The original code I was working with had those vars listed in the context of an array, hence the ":" dynamic. I applied what y'all recommended and we're good to go!
Thanks!