News:

Looking for documentation? Take a look on our wiki

Main Menu

Using VM State & Country Select elsewhere?

Started by newsomjk, March 18, 2014, 00:27:23 AM

Previous topic - Next topic

newsomjk

I'm building a custom component for our sales department to manage our users and subscription groups, part of which includes selecting the user's state/country.

I tried copying the code from the registration form, I have these lines set up:


<select id="virtuemart_country_id" name="virtuemart_country_id" class="vm-chzn-select required chzn-done singlebox" aria-required="true" required="required" style="display: none;">
...
</select>
<select id="virtuemart_state_id" name="virtuemart_state_id" required="" class="vm-chzn-select chzn-done singlebox" style="display: none;">
...
</select>


And I added this javascript:

<script src="/components/com_virtuemart/assets/js/vmsite.js" type="text/javascript"></script>

jQuery(document).ready(function($){
$(".singlebox").chosen({no_results_text: "Oops, nothing found!",max_selected_options:1,width:"20%"});
//$(".vm-chzn-select").chosen({enable_select_all: true,select_all_text : vm2string.select_all_text,select_some_options_text:vm2string.select_some_options_text});
$("#virtuemart_country_id").vm2front("list",{dest : "#virtuemart_state_id",ids : "",prefiks : ""});
});
</script>


But the state list doesn't update when you pick a country, and no js errors are thrown. Any ideas?