F
Filament3mo ago
zemo

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!
Solution:
I think this is also possible with $livewire->data[]
Jump to solution
8 Replies
toeknee
toeknee3mo ago
$livewire->ownerRecord ?
Solution
lolmaheen
lolmaheen3mo ago
I think this is also possible with $livewire->data[]
lolmaheen
lolmaheen3mo ago
would this work on a form page? when the record doesn't exist
zemo
zemoOP3mo ago
how do I use $livewire? which dependency do I have to inject in the fn()?
toeknee
toeknee3mo ago
yes Possibly as record should exist as an option
lolmaheen
lolmaheen3mo ago
fn($livewire) =>
zemo
zemoOP3mo ago
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
toeknee
toeknee3mo ago
Welcomes
Want results from more Discord servers?
Add your server