HintAction Adding to Select Element
Hello - I'm wondering if anyone has ever had an issue using a hintAction to add to a select element. Here is the relevant code:
Two issues:
1. It is not setting the
meal_id
after creating the meal in the hintAction
2. After searching for and selecting the meal, it disappears
I feel like these two issues are related (#1 might just happen quickly enough that I don't see it selected initially)Solution:Jump to solution
Of course the answer was in the docs...
->createOptionUsing()
needs to return the ID of the newly created model3 Replies
Can you try with this example!
Trying this now!
@TranceCode I never knew about
->createOptionForm
and ->createOptionUsing
, those are great. Thank you!
Turns out my issue was here though: $set('meal_id', $meal);
Should have been $set('meal_id', $meal->id);
But I'm sticking with createOption
, I like it better than hintAction in this case
Actually I didn't fix the issue...
Does not set the meal_id
Any ideas?Solution
Of course the answer was in the docs...
->createOptionUsing()
needs to return the ID of the newly created model