if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
in my createOptionForm I cannot seem to use Filament validation rules for the inputs. Is it because I'm using createOptionUsing?
do I have to call the Illuminate\Support\Facades\Validator and validate manually?
19 Replies
It shoudn't matter as far as I am aware, what error are you getting?
no error, it simply isn't working
->unique(modifyRuleUsing: function (Unique $rule, Get $get) {
ray($get('subject_id'));
return $rule->where('subject_id', $get('subject_id'))->withoutTrashed();
})
I'm also using this same rule in a normal form (no createOptionForm) and it is working.try adding
->fillForm([])
else, refer to what error is shown
what is this used for and where do I add it?
error: Method Filament\Forms\Components\Select::fillForm does not exist.
(same with TextInput)
Sorry wrong chat.
Unique should work, if you DD in the fucntion what happens? or error_log? is it hit?
nothing, the dd is not fired at all
neither the error_log() (I think, I've never used this but placing it in the callback fn before the return is doing nothing)
Can you provide the whole code?
yes, thanks
one sec
goddamnit the message is too long lol
I hope this is fine as well
can you run
php artisan about
and tell me the filament version
v3.2.96
Strange, try moving the creatoptionform to be first, but as far as I am aware it should work
I'd also upgrade to the latest version to be safe
did both, not working
the very strange thing is that the dd() or the ray() are not firing..
cos if they fired I would've known that the issue had to do with the fn
ahhh maybe I found a logic reason as to why it is not working
Forms\Components\Select::make('subscription_id') doesn't have a relationship()
so perhaps it does not know which table to check for the unique validation rule?
no it would still fire, what if you do a custom validation rule
like the one I was trying to do (which is commented)? in the createOptionUsing
even this was not working
though, I just did this and it appears to do what I'm trying to do. might stick with it at this point