I have added all the Canadian Provinces the State List and using jQuery I am displaying only Canadian Provinces when country Canada is Selected, and if US is selected only US states displayed and for any other country hide the Select box completely use the other state/provinces text box
But I am running into problem for example if a customer forgots to enter any other field in the OCST page and hit continue, when the page reloads, the state and country options selected resets.
Is there way to do this in Miva Merchant and Am I taking the wrong approach.
Thanks
But I am running into problem for example if a customer forgots to enter any other field in the OCST page and hit continue, when the page reloads, the state and country options selected resets.
Is there way to do this in Miva Merchant and Am I taking the wrong approach.
Thanks
Code:
<div class="&mvte:global:BillState_Row; stateselect"> <label class="required" for="BillStateSelect"><span>* </span>State:</label> <select name="BillStateSelect" id="BillStateSelect"> <option value="" class="us-states">Select State</option> <mvt:if expr="g.BillStateSelect EQ 'AL'"> <option class="us-states" value="AL" selected>Alabama</option> <mvt:else> <option class="us-states" value="AL">Alabama</option> </mvt:if> <mvt:if expr="g.BillStateSelect EQ 'AK'"> <option class="us-states" value="AK" selected>Alaska</option> <mvt:else> <option class="us-states" value="AK">Alaska</option> </mvt:if> <mvt:if expr="g.BillStateSelect EQ 'AZ'"> <option class="us-states" value="AZ" selected>Arizona</option> <mvt:else> <option class="us-states" value="AZ">Arizona</option> </mvt:if> <option class="ca-states" value="">Select Province</option> <mvt:if expr="g.BillStateSelect EQ 'AB'"> <option class="ca-states" value="AB" selected>Alberta</option> <mvt:else> <option class="ca-states" value="AB">Alberta</option> </mvt:if> <mvt:if expr="g.BillStateSelect EQ 'BC'"> <option class="ca-states" value="BC" selected>British Columbia</option> <mvt:else> <option class="ca-states" value="BC">British Columbia</option> </mvt:if> </select> </div> <div class="&mvte:global:BillState_Row; other-state"> <label class="italic" for="BillState">Other State/Province:</label> <input type="text" name="BillState" id="BillState" value="&mvte:global:BillState;" class="textfield" /> </div> <script type="text/javascript"> $(document).ready(function($) { $("#BillCountry").change(function() { var bcountry = $(this).val(); if( bcountry=='CA') { $(".ca-states").show(); $(".us-states").hide(); } else if(bcountry=='US') { $(".ca-states").hide(); $(".us-state").show(); } else { $(".stateselect").hide(); $(".other-state").css("display", "block"); } }); }); </script>
Comment