createOptionForm is not saving the created record
Hello.
I have a relatively complex form to create dossiers. One on the fields of that dossier is person_id (decedent_id) which comes from the resource people. I have used the createOptionForm to have the possibility to create a new person in modal form without leaving the dossier create form.
Everything looks fine, but it gives an error: Select field [data.decedent_id] must have a [createOptionUsing()] closure set.
If I use that createOptionUsing like this:
it does nothing. I mean, it does NOT CREATE the new person record (thowing no errors at all).
I do not have a relationship between dossier and people for just one field of decedent person. Is a relationship a MUST-HAVE for a modal create form with createOptionForm?
Any ideas of how to get along this?
Thanks.
I do not write all the code, because it is too long, but the main part is:
Any help will be highly appreciated. I am really stuck here.
Tks.
2 Replies
#✅┊rules please format your post so its more readable
Also you're using createOptionUsing wrong. It expects a closure (which is what the Laravel error is telling you).
Example:
Thank you very much!!! It works perfectly. I am sorry but I did not find anything about createOptionUsing() in the documentation. Not a single example or explanation.
Also, I try to format my code as much as I can. I always use backticks, but it never appears in color and it does not always look well tabbed and fine.
I use backticks and insert the code there. I never tried to begin with pph. I'll keep on trying my best. Example;