How can I validate this?
Hi I want to validate first if the Product line and Client have chosen when i click to add button in the project.
8 Replies
Add
required()
or rules([])
to the field, and then also add afterStateUpdated()
to make it check immediately when the field is changed. Maybe also set the debounce().
ie:
where can i apply that to my code?
https://gist.github.com/thsbombase/d5161018fe1793589d92ef2861dd9b99
On your
product_line_id
Select component you have both required()
so add afterStateUpdated
as well. Same with your client
Select component.i can still click the + icon even if i did not choose product and client
it should promt that project and client is required
Oh. I wasn't looking at the + icon.
I'm not super-familiar with that Component ... but this appears to be the code that controls it:
https://github.com/filamentphp/filament/blob/7713dc2703c29ccd824cc04a48b3b95c6081898e/packages/forms/src/Components/Select.php#L264-L333
GitHub
filament/packages/forms/src/Components/Select.php at 7713dc2703c29c...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
Perhaps you might be able to use
createOptionAction()
to change the action
based on whether those other fields have a value?will check thank you