adding js to the token order form in gravity forms for the shipping for tokens only
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 24 Oct 2016 18:58:51 +0000 (14:58 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 24 Oct 2016 18:58:51 +0000 (14:58 -0400)
js/app.js
js/custom/pageSetup.js

index 373cadd..5bb0526 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -78,10 +78,19 @@ $(document).ready(function () {
                 }
             }
         }
-        if( qty_total < 5 ){
-            
+        if( qty_total < 5 && qty_total > 0  ){
+            $("#ginput_quantity_4_48").val( 1 );
+            $("#ginput_quantity_4_49").val( 0 );
+            $("#ginput_quantity_4_50").val( 0 );
+        } else if( qty_total < 11 && qty_total > 4 ){
+            $("#ginput_quantity_4_48").val( 0 );
+            $("#ginput_quantity_4_49").val( 1 );
+            $("#ginput_quantity_4_50").val( 0 );
+        } else if( qty_total < 31 && qty_total > 10  ){
+            $("#ginput_quantity_4_48").val( 0 );
+            $("#ginput_quantity_4_49").val( 0 );
+            $("#ginput_quantity_4_50").val( 1);
         }
-        console.log(qty_total);
         
     });
      
@@ -99,5 +108,5 @@ $(document).ready(function () {
     $("#field_4_50").css({"visibility": "hidden", "height" : 0});
     
     $("#input_4_41").attr("readonly", true);
-     $("#input_4_47").attr("readonly", true);
+    $("#input_4_47").attr("readonly", true);
 });
index 977cc64..70a1d37 100644 (file)
@@ -69,10 +69,19 @@ $(document).ready(function () {
                 }
             }
         }
-        if( qty_total < 5 ){
-            
+        if( qty_total < 5 && qty_total > 0  ){
+            $("#ginput_quantity_4_48").val( 1 );
+            $("#ginput_quantity_4_49").val( 0 );
+            $("#ginput_quantity_4_50").val( 0 );
+        } else if( qty_total < 11 && qty_total > 4 ){
+            $("#ginput_quantity_4_48").val( 0 );
+            $("#ginput_quantity_4_49").val( 1 );
+            $("#ginput_quantity_4_50").val( 0 );
+        } else if( qty_total < 31 && qty_total > 10  ){
+            $("#ginput_quantity_4_48").val( 0 );
+            $("#ginput_quantity_4_49").val( 0 );
+            $("#ginput_quantity_4_50").val( 1);
         }
-        console.log(qty_total);
         
     });
      
@@ -90,5 +99,5 @@ $(document).ready(function () {
     $("#field_4_50").css({"visibility": "hidden", "height" : 0});
     
     $("#input_4_41").attr("readonly", true);
-     $("#input_4_47").attr("readonly", true);
+    $("#input_4_47").attr("readonly", true);
 });