Setting rules dinamically in a livewire component
i also tried to set the rules inside the mount method, but doesn't work neither, it ignores it.
9 Replies
You can't change them in the rules set of a protected property with Livewire once the component has booted. You could set them within the rules config of the option
okay hmm
im trying to understand wdym by "You could set them within the rules config of the option"?
Can you clarify what the component is doing so we are on the right page
im storing an image relating it to a model. i want that image to be validated -> max:$dynamicValue
idk what more to tell u
that is it
what should i explain?
Can you provide the full code? With our file uploader field we have ->rules() and this accepts a closure so you can do checks etc on that level.
im not using filament
(see tag)
I was under the assumption it was a custom livewire component for a filamenet form
under the livewire discussions:
https://github.com/livewire/livewire/discussions/2569
If it's a custom livewire component completely and use hydration
GitHub
Dynamic rules for property binding · livewire livewire · Discussion...
I am building a Livewire component that I intend to use dynamically with different models. It will simply display a table with all records of a certain models, with buttons to delete and edit. My a...
oh i see, so i have to move it from mounted to render method
thanks for the help, im going to try it now, lets see