inline-boolean icon indicating copy to clipboard operation
inline-boolean copied to clipboard

Update fails on index and detail views with other required fields

Open FabienFrays opened this issue 5 years ago • 7 comments

Hi, Thank's for your package. The saving fails on index and detail views when the resource has any fields with a required rule. Regards, Fabien

FabienFrays avatar Jun 12 '19 15:06 FabienFrays

@FabienFrays Could you try doing this as a temporary workaround to see if it's fixed? I won't be able to look into the main issue for some time.

return [
    Text::make('column')
        ->rules('required')
        ->hideFromIndex(),

    Text::make('column')
        ->onlyOnIndex(),

    InlineBoolean::make('bool_column') 
        -> ...
];

If you could also please provide a code sample as I was not able to immediately reproduce your issue.

markrassamni avatar Jun 15 '19 02:06 markrassamni

Ok thanks.

FabienFrays avatar Jun 18 '19 12:06 FabienFrays

I have the same issue, when using BelongsTo Field hideFromIndex() didn't help

BelongsTo::make('Проект','project','App\Nova\Project')->withMeta([
                'belongsToId' => 1
            ])->readonly()->hideFromIndex(),
BelongsTo::make('Автор','user','\App\Nova\User')->withMeta([
                'belongsToId' => $this->user_id ?? auth()->user()->id
            ])->readonly()->hideFromIndex(),

mpanius avatar Jun 19 '19 10:06 mpanius

Found a workaround thanks to nova-inline-select

Add the following updateRules to all fields that are marked as required

Text::make('Email')
    ->rules('required', 'email')
    ->updateRules('sometimes'),

garrettjoecox avatar Sep 07 '19 14:09 garrettjoecox

I have the same issue, when using BelongsTo Field hideFromIndex() didn't help

BelongsTo::make('Проект','project','App\Nova\Project')->withMeta([
                'belongsToId' => 1
            ])->readonly()->hideFromIndex(),
BelongsTo::make('Автор','user','\App\Nova\User')->withMeta([
                'belongsToId' => $this->user_id ?? auth()->user()->id
            ])->readonly()->hideFromIndex(),

Same issue here but using ->readonly()->hideFromIndex() works for me

kamilkozak avatar Jan 12 '20 12:01 kamilkozak

can confirm:

->updateRules('sometimes'),

does solve this issue for me. but it seems like an ugly solution to me.

michapixel avatar Apr 06 '20 09:04 michapixel

For me just adding ->readonly() on BelongsTo fields made the 422 go away

vesper8 avatar Jan 14 '21 11:01 vesper8