My form contains fields:
region:
label: Region
type: dropdown
options: listRegions
district:
label: District
type: dropdown
options: listDistricts
dependsOn: region
city:
label: City
type: dropdown
options: listCities
dependsOn: district
Code in model:
public function listRegions($value, $data)
{
$regions = Regions::getRegions();
if($value) $regions[$value] = $value; // if not contain
return $regions;
}
public function listDistricts($value, $data)
{
$districts = Regions::getDistricts($this->region);
if($value) $districts[$value] = $value; // if not contain
return $districts;
}
public function listCities($value, $data)
{
$cities = Regions::getCities($this->region, $this->district);
if($value) $cities[$value] = $value; // if not contain
return $cities;
}
In real backend this magic works perfectly, in backtofront no =(
I am forced to perform such a fix:
$('#Form-field-Offer-region').trigger('change');
$('#Form-field-Offer-district').trigger('change');
I found out that in my functions (listDistricts eg) $this is null when a call from BackToFront.
In real backend $this is model object.
The error is precisely at the initial filling of the elements. With manual clicking, this works just as well as in backend.
Last updated


