laravel-nova-nested-form
laravel-nova-nested-form copied to clipboard
How to pass a parameter to child nested form?
Passing a parameter to nasted form:
My basic form has a select input with 2 options, depends on a chosen option i should use different riles in my nestedDFrm...so is it possible to get that select value and pass it ti my form?
There is the place i am adding the form:
NestedForm::make('DebtAllocations')->open(true)->min(1),
HasMany::make('DebtAllocations'),
Here also i have currency option select added.
There is inside DebtAllocations form:
Number::make('Amount', 'amount')->onlyOnForms()->rules('required')
And i need to set maximum posiible amount depends on currency - so for example, if currency is 'euro' the limit is 1000, but if currency is 'usd', the limit is 800
Hi, I'm sorry, i'm not sure I understand what the issue is. If you're trying to set a maximum amount based on the given currency then I don't think the problem is related to this package, can you give me an example?
I think you could use a custom validation rule, attached to nested form
Hi, I'm sorry, i'm not sure I understand what the issue is. If you're trying to set a maximum amount based on the given currency then I don't think the problem is related to this package, can you give me an example?
There is an example:
On the image above you can see that i chose ''EUR" as my currency.
So in the debt allocation table below i should limit maximum amount to 800 eurs.
In case i will choose "USD" instead of "EUR", the maximum amount will be 1000$
That what i am trying to do, but the problem is that i dont know how to get currency type(EUR or USD) to apply my validation rule in NestedForm::make('DebtAllocations')
.
Is it possible?
Request::input("currency") ?
@alberto-bottarini can you please elaborate?
I think I was drunk. I do not remember what I intended
I have the same issue: I want to pass data to the nested form. Is there a way to do that? It basically requires JS to do it. right?