mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-25 12:41:16 -08:00
Handle old input
This commit is contained in:
parent
d0a351a132
commit
c3165717ed
|
@ -27,9 +27,6 @@ class CustomFieldSetDefaultValuesForModel extends Component
|
||||||
$this->fields->each(function ($field) {
|
$this->fields->each(function ($field) {
|
||||||
$this->setSelectedValueForField($field);
|
$this->setSelectedValueForField($field);
|
||||||
});
|
});
|
||||||
|
|
||||||
dump(old('default_values'));
|
|
||||||
dump($this->selectedValues);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Computed]
|
#[Computed]
|
||||||
|
@ -59,9 +56,11 @@ class CustomFieldSetDefaultValuesForModel extends Component
|
||||||
{
|
{
|
||||||
$defaultValue = $field->defaultValue($this->model_id);
|
$defaultValue = $field->defaultValue($this->model_id);
|
||||||
|
|
||||||
// if we have old input for this field, use that instead
|
// if old() contains a value for default_values that means
|
||||||
if (old('default_values.' . $field->id)) {
|
// the user has submitted the form and we were redirected
|
||||||
// @todo: need to handle old input being null on purpose...
|
// back with the old input.
|
||||||
|
// Let's use what they had previously set.
|
||||||
|
if (old('default_values')) {
|
||||||
$defaultValue = old('default_values.' . $field->id);
|
$defaultValue = old('default_values.' . $field->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue