Comments (1)
Hey @CherryDT — there are a few complexities with this that make it somewhat difficult to accomplish what you're looking for without some side-effects.
Marking a field as readOnly
indeed keeps the field in the form state so that you can access / manipulate it. It also means that when you run functions like form.getData()
, that field will indeed be included in the data from the form. But you're right, the field's data will indeed be sent through the REST request for create / update.
There are some alternatives, though. You can use admin.disabled: true
to completely disable the field, which will then completely hide the field from the admin UI. You could then use a custom UI component to show the field's value in a read-only fashion.
Alternatively, you could add a beforeValidate
hook that simply takes the field's originalDoc
value and returns that, omitting whatever was passed from the API, and reverting back to the value you want.
We might be able to solve for this at some point in the near-future, but it likely will be against 3.0. I will mark this as a Feature Request for now and we will keep an eye on interest for this topic. If more people show interest, we will prioritize a way to make this happen!
from payload.
Related Issues (20)
- Overwriting file uploads doesn't update URL HOT 2
- req.locale incorrect for access control functions HOT 1
- No additional image sizes are generated on image upload while using "imageSizes" HOT 2
- Update Unlock Documentation to Include Email Parameter
- 504 Gateway Timeout with Form Fields large data
- [UI] Document deletion modal: Content misalignment
- Relationship field is of type number | MyType
- Next.js Middleware not working in Custom Server example after build process
- Image metadata stripped from image when using upload.imageSizes
- Type signature mismatch between auth email configurations
- Fields in groups ignore typical table naming convention (postgres)
- Blocks in blocks not possible in v3 with Postgres
- Type collision with generated types HOT 5
- Errors given by local api do not match exported errors
- Bug with Lexical Html converter including Fix
- Disabling auth local strategy causes /api/users/me to no longer work
- Node.js API not supported in Edge Runtime warnings when using basic Next.js middleware
- Image resize bug - filename conflicts when two `imageSizes` configs are of the same dimensions
- Nested blocks error with localization on Postgres DB
- Uploads with "%" in filename fail to show (s3Adapter)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from payload.