ngx-schema-form
ngx-schema-form copied to clipboard
Attribute DISABLED and READONLY
The current default widget library does not set the attributes disabled
and readonly
consistently.
Both attributes are mapped to the schema property readOnly
.
The current mapping so far:
DISABLED
- checkbox
- file
- select
- radio
- range
READONLY
- integer
- string
- textarea
When readonly
attribute is set the form does send the value
while when the disabled
attribute is set the form doesn't send the value of the input/select (whatever) element.
I think both states readonly
and disabled
should be supported separately.
Suggestion
{
"myField":{
"type":"string",
"readOnly":true,
"widget":{
"id":"string",
"disabled":true
}
}
}
The property myField.readOnly
will consistently mapped to the HTML attribute readonly
while the property myField.widget.disabled
set the HTML attribute disabled
.
The reason for keeping readOnly
in the schema section is that readOnly
is JSON Schema compliant while disabled
is moved to the widget section because it refers to the ui-widget itself.
So readOnly
could have the same behavior as an HTML element and have only a
one way binding.
This may cause breaking changes, but would clarify a lot.