From d0e97ac434c9744a1f8d436578b3537b6eb44c17 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Mon, 24 Oct 2016 14:58:51 -0400 Subject: [PATCH] adding js to the token order form in gravity forms for the shipping for tokens only --- js/app.js | 17 +++++++++++++---- js/custom/pageSetup.js | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/js/app.js b/js/app.js index 373cadd..5bb0526 100644 --- 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); }); diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 977cc64..70a1d37 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -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); }); -- 2.17.1