A module doing address-form fields with dependent pre-set country-region drop-downs. Countries & regions powered by:
250 countries & regions worldwide available
the module part will take care of dep-drop ajax queries
'modules' => [
//...
'addressform' =>[
'class' => \tonisormisson\addressform\Module::class,
],
//...
]
use tonisormisson\addressform\AddressForm;
echo AddressForm::widget([
'allowedCountries' => ["EE", "LV", "LT"],
'defaultCountry' => "EE",
'placeHolders' = [
// custom placeholders here if needed
'country' => ,
'state' => ,
'city' => ,
'postCode' => ,
'addressLine1' => ,
'addressLine2' => ,
],
]);
use tonisormisson\addressform\models\Address;
$address = new Address();
$address->load(Yii::$app->request->post());
// load the address to your models
// eg :
$model->address_data = Json::encode($address);