Attempting mobile phone validation with js
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 2 Nov 2015 21:41:20 +0000 (16:41 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 2 Nov 2015 21:41:20 +0000 (16:41 -0500)
js/app.js
js/custom/pageSetup.js

index c3d1e8b..14c170a 100644 (file)
--- 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({
index b514f78..70b46f4 100644 (file)
@@ -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({