json-forms icon indicating copy to clipboard operation
json-forms copied to clipboard

Poperly disable all inputs for readonly properties

Open idelvall opened this issue 9 years ago • 6 comments

http://brutusin.org/json-forms/#12

idelvall avatar May 03 '16 09:05 idelvall

I originally thought it would only be necessary for primitives and arrays, because an object could just have its members marked as read only, but now I see some use cases where it is in fact the object that should be marked as such. Working on a patch.

ocschwar avatar May 06 '16 03:05 ocschwar

What does properly disabling read only inputs look like? Especially for non-bootstrap components.

For bootstrap, there's the static controls.
https://v4-alpha.getbootstrap.com/components/forms/#static-controls

zamicol avatar Dec 20 '16 16:12 zamicol

My first impression was that "bar" and "corge" inputs should be disabled too , but maybe this is not right, given that the type of the array item can also be mark as readonly. So I can't see the issue now.

Maybe @ocschwar can give us more info.

idelvall avatar Dec 20 '16 17:12 idelvall

Hi, all. Sorry I've vanished into the ether the last few months. My feeling is that the "readOnly" attribute should be inherited. So if the root of the schema starts with "false", every element is writeable until you hit an element that is set to "true." Then, the descendants are marked as disabled, until you hit an element where it's set to false. And so on and so forth.

ocschwar avatar Dec 20 '16 17:12 ocschwar

makes sense... but why rendering this tree at all?

idelvall avatar Dec 20 '16 17:12 idelvall

It lets you set whether an object should have attributes added or removed, and whether an array should be added to or subtracted from.

ocschwar avatar Dec 20 '16 18:12 ocschwar