custom form default value not working
I have a custom form where the
default()
does not work for fields. I can fill the state in the mount action but shouldnt the default just work?5 Replies
->default()
is only for creation / when that field isn't passedso when you would put a default and youre adding the form fill it doesnt work anymore?
even if you dont address the specific field youre filling?
Hm, I'm not sure how it works outside the admin panel. But I guess as soon as you use
$form->fill()
$this->form->fill()
fills defaults as if it was a Create form
$this->form->fill([])
fills existing data as if it was an Edit form
if youre passing existing data, theres no reason not to pass "defaults" in that array toookey, i will do it this way! thx @Dan Harrin @Dennis Koch !