8.4.2 How to use StatesProvincesList with CountryList
Permalink
I can load arrays of countries and states from CountryList and StatesProvincesList into select boxes and use ajax to filter the states on selecting a country.
However I see in the address attribute code the following statement: "@deprecated Use $app->make(\Concrete\Core\Form\Service\Form::class')->selectCountry() to link a Country field and a State/Province field". I don't quite get what this means. How do I use that selectCountry() to have the two select boxes linked? API doesn't find this function.
However I see in the address attribute code the following statement: "@deprecated Use $app->make(\Concrete\Core\Form\Service\Form::class')->selectCountry() to link a Country field and a State/Province field". I don't quite get what this means. How do I use that selectCountry() to have the two select boxes linked? API doesn't find this function.
See here for an example:https://github.com/concrete5/concrete5/blob/95e79fe32c851da4d80f1a3b...
Yes, I've seen that. I was wondering if there was an in-build link between the two and I didn't have to use JS to filter it.
This is what I've got:
I was wondering if there is simpler way.
This is what I've got:
<div class="row"> <div class="col-xs-12"> <div class="form-group"> <?php echo $form->label('country', t('Country')); echo $form->selectCountry('country', $country->getCountry()); ?> </div> </div> </div> <div class="row"> <div class="col-xs-12"> <div class="form-group"> <?php echo $form->label('state', t('State'));
Viewing 15 lines of 50 lines. View entire code block.
I was wondering if there is simpler way.
In the example I linked above there's no JavaScript, and the two fields are linked (read this linehttps://github.com/concrete5/concrete5/blob/95e79fe32c851da4d80f1a3b... )