From c43718af3ed0444d60d946d3a43441bdd2ccb94c Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Mon, 2 Nov 2015 16:41:20 -0500 Subject: [PATCH] Attempting mobile phone validation with js --- js/app.js | 12 +++++++----- js/custom/pageSetup.js | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/js/app.js b/js/app.js index c3d1e8b..14c170a 100644 --- a/js/app.js +++ b/js/app.js @@ -70,10 +70,10 @@ $(document).ready(function () { // restrict datepicker for days after current date and 2 days after that date [min] $("#dateOff1").change(function () { - today = $("#dateOff1").val(); - today = new Date(today); + currentDate = $("#dateOff1").val(); + today = new Date(); minDays = 2; - today.setDate(today.getDate()); + today.setDate(today.getDate() + minDays); d = today.getDate(); if (d <= 9) { d = '0' + d; @@ -84,8 +84,10 @@ $(document).ready(function () { } y = today.getFullYear(); requiredDate = y + '-' + m + '-' + d; - $("#dateOff1").val(""); - $("#dateOff1").val(requiredDate); + if (currentDate !== requiredDate) { + alert("bo"); + } + }); $("#date1").datepicker({ diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index b514f78..70b46f4 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -61,10 +61,10 @@ $(document).ready(function () { // restrict datepicker for days after current date and 2 days after that date [min] $("#dateOff1").change(function () { - today = $("#dateOff1").val(); - today = new Date(today); + currentDate = $("#dateOff1").val(); + today = new Date(); minDays = 2; - today.setDate(today.getDate()); + today.setDate(today.getDate() + minDays); d = today.getDate(); if (d <= 9) { d = '0' + d; @@ -75,8 +75,10 @@ $(document).ready(function () { } y = today.getFullYear(); requiredDate = y + '-' + m + '-' + d; - $("#dateOff1").val(""); - $("#dateOff1").val(requiredDate); + if (currentDate !== requiredDate) { + alert("bo"); + } + }); $("#date1").datepicker({ -- 2.17.1