How to Get $get an input that is in the main form from the ->createOptionForm modal
Context: I have a form to create a payment where you select a subscription year. Then you have to select an existent subscription (based on the subscription year).
If there is no subscription, you can create one in the modal (I've used the ->createOptionForm method to achieve this).
For a subscription to be created, you have to select a subscription year. Because you've already selected it in the process of creating the payment, I would like to Get $get it automatically.
How do I achieve this? How do I access the subscription_year selected in the main form?
There are basically two inputs with the same name. subscription_year_id in the main form, and subscription_year_id in the ->createOptionForm modal.
Thanks!
8 Replies
$livewire->ownerRecord ?
Solution
I think this is also possible with $livewire->data[]
would this work on a form page? when the record doesn't exist
how do I use $livewire? which dependency do I have to inject in the fn()?
yes
Possibly as record should exist as an option
fn($livewire) =>
this returns: Property [$ownerRecord] not found on component
I will try this :))
for context, I'm using the ->default() method with a callback fn to set the subscription_year_id in the modal form.
it worked @lolmaheen, thank you so much 🫶🏻
I really appreciate it
Welcomes