GithubHelp home page GithubHelp logo

Comments (1)

jmikrut avatar jmikrut commented on June 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.