react-jsonschema-form
react-jsonschema-form copied to clipboard
Read-only field with generated value (uuid)?
Prerequisites
- [X] I have read the documentation
What theme are you using?
bootstrap-4
What is your question?
This seems obvious, but I can't find it in the docs or any issues, at least with the keywords I've tried searching with. I have many fields in my schema that require uuids. I'd like to just auto-generate those for new entries and make them read-only as a reference for the user. I see that I can create a custom widget to do this, but then I have to recreate the HTML for the TextWidget. I'd like to just use a text widget, but set disabled=true
and generate a uuid value
if it's not in the formData
.
How can I achieve that?
You could copy the source for the BaseInputTemplate
and modify it for your purposes and replace the default template with yours. See the templates docs for more information on how to do this.
This issue has been automatically marked as possibly close because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.
This issue was closed because of lack of recent activity. Reopen if you still need assistance.