Avoiding cascade on Dependent fields #5972
Replies: 3 comments
-
Can you post an example of a real-life situation where you would use this? |
Beta Was this translation helpful? Give feedback.
-
I would need this in a very complex situation and i don't want to bother you with all the details, so i'll try to reduce it to a simple case: imagine i have a form with three fields:
they are related based on this simple equation: if you change the product price, the total price should change this would help an agent figure out how many extras a client could add to a purchase in case the client reveals his budget... |
Beta Was this translation helpful? Give feedback.
-
Released with Laravel Nova 5.0.0 Feel free to open up a new issue if you're still experiencing this problem on the latest version. |
Beta Was this translation helpful? Give feedback.
-
Hi, it would be really appreciated to have a
->avoidCascade()
option for dependent fields where you could determine if changes on the current field should trigger syncs on their dependent fields. For example, I have a complex form where i have several fields depending on each other. I need them to trigger changes on each other, but this changes shouldn't trigger sync on the initial field to avoid infinite loops.this could be achieved by adding a
$avoidCascade
property to theSupportsDependentFields
traitAdding an
avoidCascade
parameter to theemitFieldValueChangeFunction
in theFormEvents.js
mixin:Adding the parameter to the emission of the event in the
DependentFormField.js
mixin:and finally applying the
avoidCascade
option to thedependentFormField
handler in the mounted function of the same file.If this is implemented by Nova i can use any kind of field. otherwise i need to create custom fields for each type of dependent field where i need to avoid cascading.
Beta Was this translation helpful? Give feedback.
All reactions