json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

How do I disable a field? #919

Closed marmite22 closed 7 years ago

marmite22 commented 7 years ago

Hi,

I've got some fields that I want to set to disabled however I can only seem to find references to readonly.

Is there a way to disable form fields?

Thanks

Anthropic commented 7 years ago

@marmite22 the readonly flag actually sets the field to disabled, it was like that when I started working on it. Something I hope to correct at some point when I get past other priorities.

Please re-open if you do not feel the question has been answered sufficiently.

snowymike commented 5 years ago

@Anthropic any plans to revisit that and make readonly mean readonly instead of disabled?

one annoyance of readonly mapping to disabled involves trying to add copy to clipboard support for a read only field. straightforward (https://www.w3schools.com/howto/howto_js_copy_clipboard.asp) JS techniques of copying an input or textarea to the clipboard work fine for readonly inputs/textareas but not for disabled ones. instead i'm using the technique of https://stackoverflow.com/questions/22581345/click-button-copy-to-clipboard-using-jquery/22581382 to copy the disabled items to non-disabled, off the screen elements, then copying them.