javascript - Uncaught ReferenceError: update_zone is not defined
one text
When I select a country, the zone must be displayed on dropdown after to click on a selected country dropdown. But in my case, I have this error come from console :
Uncaught ReferenceError: update_zone is not defined
below my code
my state_dropdown.php (js)
`
<script>
function resetZoneSelected(theForm) {
if (theForm.state.value != '') {
theForm.state.selectedIndex = '0';
if (theForm.state.options.length > 0) {
theForm.state.value = '<?php echo CLICSHOPPING::getDef('js_state_select'); ?>';
}
}
}
function update_zone(theForm) {
let NumState = theForm.state.options.length;
let SelectedCountry = "";
while(NumState > 0) {
NumState--;
theForm.state.options[NumState] = null;
}
SelectedCountry = theForm.country.options[theForm.country.selectedIndex].value;
<?php echo HTMLOverrideAdmin::getJsZoneList('SelectedCountry', 'theForm', 'state'); ?>
}
</script>
my code to call that.
<?php echo HTML::selectMenuCountryList('country', null, 'onchange="update_zone(this.form);" aria-required="true"'); ?>
I select form example France
<?php echo HTML::selectField('state', $Address->getPrepareCountryZonesPullDown(), null, 'aria-required="true"'); ?>
In this case inside my dropdown, I must See a state as Var for example. But this case does no work. I have nothing
and at the end :
include_once('javascript/state_dropdown.php');
The code below does not work and I have Uncaught ReferenceError: update_zone is not defined
Thank you
Source