F
Filament3d ago
zemo

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
toeknee
toeknee3d ago
It shoudn't matter as far as I am aware, what error are you getting?
zemo
zemo3d ago
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.
toeknee
toeknee3d ago
try adding ->fillForm([]) else, refer to what error is shown
zemo
zemo3d ago
what is this used for and where do I add it?
toeknee
toeknee3d ago
->fillForm([])
->unique(modifyRuleUsing: function (Unique $rule, Get $get) {
ray($get('subject_id'));
return $rule->where('subject_id', $get('subject_id'))->withoutTrashed();
})
->fillForm([])
->unique(modifyRuleUsing: function (Unique $rule, Get $get) {
ray($get('subject_id'));
return $rule->where('subject_id', $get('subject_id'))->withoutTrashed();
})
zemo
zemo3d ago
error: Method Filament\Forms\Components\Select::fillForm does not exist. (same with TextInput)
toeknee
toeknee3d ago
Sorry wrong chat. Unique should work, if you DD in the fucntion what happens? or error_log? is it hit?
zemo
zemo3d ago
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)
toeknee
toeknee3d ago
Can you provide the whole code?
zemo
zemo3d ago
yes, thanks one sec goddamnit the message is too long lol
zemo
zemo3d ago
I hope this is fine as well
toeknee
toeknee3d ago
can you run php artisan about and tell me the filament version
zemo
zemo3d ago
v3.2.96
toeknee
toeknee3d ago
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
Want results from more Discord servers?
Add your server