Can I hide the 'States' list unless someone selects USA/Canada from the country drop-down?
This change will hide the 'Select state/province if applicable' list unless either the USA or Canada is selected in the list.
1. Go to 'Design | Library | Layouts' and expand the 'Checkout Area' group.
2. Open the 'Delivery Location' layout.
3. Locate this code:
4. Replace it with this code:
5. Now click 'OK' on this layout and go to the 'Delivery' country list group.
6. Open the 'Delivery Country List' layout
7. Click the orange 'Click here to edit list layout settings' link.
8. Replace the entire contents of the 'Start Of List' field with the following:
9. Click OK (twice) and then close the library and upload.
Note that the 'US' and 'CA' in bold in the code above are the country codes for the USA and Canada. You can replace these with different country codes if you want this to happen with different locations.
This change will hide the 'Select state/province if applicable' list unless either the USA or Canada is selected in the list.
1. Go to 'Design | Library | Layouts' and expand the 'Checkout Area' group.
2. Open the 'Delivery Location' layout.
3. Locate this code:
HTML Code:
<Actinic:LOCATION TYPE="DELIVERSELECTSTATE"> <actinic:variable name="DeliveryStateList" /> </Actinic:LOCATION>
HTML Code:
<div id="showhidearea" style="visibility: hidden"> <Actinic:LOCATION TYPE="DELIVERSELECTSTATE"> <actinic:variable name="DeliveryStateList" /> </Actinic:LOCATION> </div>
6. Open the 'Delivery Country List' layout
7. Click the orange 'Click here to edit list layout settings' link.
8. Replace the entire contents of the 'Start Of List' field with the following:
HTML Code:
<select id="lstDeliveryCountry" name="LocationDeliveryCountry" onchange="javascript:div = document.getElementById('showhidearea'); if (this.options[this.selectedIndex].value == 'US' || this.options[this.selectedIndex].value == 'CA') div.style.visibility = 'visible'; else div.style.visibility = 'hidden';"> <option value=""> <Actinic:Variable Name="SelectCountry" if="%3cactinic%3avariable%20name%3d%22InvoiceLocationIsUsed%22%20%2f%3e%20%3d%3d%20False"/> <Actinic:Variable Name="UseInvoiceLocation" if="%3cactinic%3avariable%20name%3d%22InvoiceLocationIsUsed%22%20%2f%3e"/>
Note that the 'US' and 'CA' in bold in the code above are the country codes for the USA and Canada. You can replace these with different country codes if you want this to happen with different locations.