Skip to content

Commit 6d60b02

Browse files
committed
fix bug
1 parent 0abeeeb commit 6d60b02

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Gustiawan/FormBuilder/Form.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,10 @@ private function parseField(string $type, string $name, string $label, array $op
233233
"class" => array_key_exists("class", $options) ? $options['class'] : "",
234234
];
235235

236-
if (array_key_exists("value", $options)) {
237-
$field['value'] = $options['value'];
238-
}
236+
$data = (array_key_exists($name, $this->data) ? $this->data[$name] : $default_value);
237+
$value = array_key_exists("value", $options) ? $options['value'] : null;
239238

240-
$field['value'] = (array_key_exists($name, $this->data) ? $this->data[$name] : $default_value);
239+
$field['value'] = $data ?? $value;
241240

242241
return $field;
243242
}

0 commit comments

Comments
 (0)