ideas icon indicating copy to clipboard operation
ideas copied to clipboard

Ability to make fields read only after entry was created

Open aerni opened this issue 3 years ago • 5 comments

You might have a blueprint field that should be editable when creating the entry but read_only when editing the entry. This is useful for e-commerce.

I'm creating orders with Stripe Webhooks. Some fields shouldn't be editable after the fact. You could simply set read_only: false to begin with, but this is an issue if you want to manually create an order in the CP because the fields would be locked.

I'm imagining something like editable: false that would make the field read_only when editing an entry.

aerni avatar Apr 20 '22 10:04 aerni

What's an example of a field you'd manually enter when creating but not when editing?

jasonvarga avatar Apr 20 '22 17:04 jasonvarga

Here's an example, e.g., Number, Amount, and Date.

Bildschirmfoto 2022-04-20 um 19 39 57

aerni avatar Apr 20 '22 17:04 aerni

What if you made a mistake?

jasonvarga avatar Apr 20 '22 17:04 jasonvarga

You delete the entry and create a new one. In this scenario, it's a bigger risk that a user might change a value that shouldn't change than it is to create a new entry.

This would be similar to hideWhenUpdating in Laravel Nova.

aerni avatar Apr 20 '22 17:04 aerni

Being able to set the visibility property with a callable class would kill two birds with one stone - visibility: 'new \App\Support\Visibility::function()'

We would like to make a certain field read-only on a certain environment - so a class or closure would let us. It would also allow this original idea to be implemented via custom code.

macaws avatar May 23 '25 18:05 macaws