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
Dennis Koch
Dennis Koch2y ago
->default() is only for creation / when that field isn't passed
pieter_wessel
pieter_wesselOP2y ago
so 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?
Dennis Koch
Dennis Koch2y ago
Hm, I'm not sure how it works outside the admin panel. But I guess as soon as you use $form->fill()
Dan Harrin
Dan Harrin2y ago
$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 too
pieter_wessel
pieter_wesselOP2y ago
okey, i will do it this way! thx @Dan Harrin @Dennis Koch !
Want results from more Discord servers?
Add your server