This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
sehan
I tried to save the data from field that I already Hidden, because the dropdown options can only get the one key.. so I must to get the data by creating new field in different column data, and I want to hide the field so that form is organized and clear here'is the field.yaml
office_name:
label: Name
span: left
type: dropdown
placeholder: -- select a status --
url:
label: URL
span: right
type: dropdown
dependsOn: office_name
hidden: true
the_name_office:
label: Office Name
span: right
type: dropdown
dependsOn: office_name
hidden: true
this is the model
public function getOfficeNameOptions()
{
return Office::lists('name','id');
}
public function getUrlOptions($value, $data)
{
$officeId = isset($data->office_name)
? $data->office_name
: key($this->getOfficeNameOptions());
$office = Office::find($officeId);
return [$office->url => $office->url];
}
public function getTheNameOfficeOptions($value, $data)
{
$officeId = isset($data->office_name)
? $data->office_name
: key($this->getOfficeNameOptions());
$office = Office::find($officeId);
return [$office->name => $office->name];
}
but the field that i'm hidden it, can't save the value key. I hope this will solve
Last updated
1-1 of 1