How to validate inside `handleRecordCreation()` or `mutateFormDataBeforeSave`

Hello guys, hope you're doing well! I want to validate or use a custom validation rule inside mutateFormDataBeforeSave(), wonder how to do that? Thanks in advance!
4 Replies
Jellibloom
Jellibloom3mo ago
Hey @Leandro Ferreira, and thanks a lot for your help! I'm using a repeater, and I want to get values that are outside the repeater I added this rule to one of the repeater attributes, but I it only get the values inside a single repeater
->rules([
fn (Forms\Get $get): Closure => function (string $attribute, $value, Closure $fail) use ($get) {
info($get('id'));
->rules([
fn (Forms\Get $get): Closure => function (string $attribute, $value, Closure $fail) use ($get) {
info($get('id'));
So that's why I thought of making the validation inside handleRecordCreation and mutateFormDataBeforeSave, but then wondered how to display the validation error before running $this->halt();
Jellibloom
Jellibloom3mo ago
You're a life saver man, thanks!