troubleshooting Question


Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla asked on
13 Comments4 Solutions243 ViewsLast Modified:
Hi experts, I wish to use Boolean to check whether true or false. The code below is not working, Any help please!

<!Doctype Html>
<input type="text" id="bday"/>
<button onclick="ValiDate()">Validate</button>

function ValiDate()
  if (ValiBday == true)

function ValiBday()
//I get the value of the input element
  var inputValue=document.getElementById('bday').value;
// I create a new var with Regex rule to get only numbers
  var pattern =/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/;
//I set a flag boolen to test if the inputValue has RegEx format
  var flag=pattern.test(inputValue);
//I create an if condition to check if flag is true or false
    ValiBday = "false";
    return false;
  //I parse the value to date object time in unix format (ms)
  var birthday =Date.parse(document.getElementById('bday').value); 
  //I check the condition  
        ValiBday = "false";
        return false;
        ValiBday = "true";


Open in new window

Join our community to see this answer!
Unlock 4 Answers and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros