jsonform
jsonform copied to clipboard
customFormItems doesn't support "disabled": true for nested items in a selectfieldset
Using customFormItems to customise sub-form items doesn't seem to support "disabled": true
. In the following example, the "text.text1" field should be disabled:
{
"schema": {
"choice": {
"type": "string",
"enum": [ "text", "cat" ]
},
"text": {
"type": "object",
"properties": {
"text1": {
"type": "string",
"title": "Text1"
},
"text2": {
"type": "string",
"title": "Text2"
}
}
},
"category": {
"type": "string",
"title": "Category",
"enum": [
"Geography",
"Entertainment",
"History",
"Arts",
"Science",
"Sports"
]
}
},
"form": [
{
"type": "selectfieldset",
"key": "choice",
"title": "Make a choice",
"titleMap": {
"text": "Search by text",
"cat": "Search by category"
},
"items": [
{
"key": "text",
},
{
"key": "category"
}
],
},
{
"type": "submit",
"value": "Submit"
}
],
"customFormItems": {
"text.text1": {
"append": "today",
"disabled": true
},
"text.text2": {
"append": "tomorrow"
}
}
}
As I said, it's not "customFormItems", it's probably "selectfieldset" caused problem.
2015-08-17 14:04 GMT+08:00 epitomus [email protected]:
Using customFormItems to customise sub-form items doesn't seem to support "disabled": true. In the following example, the "text.text1" field should be disabled:
{ "schema": { "choice": { "type": "string", "enum": [ "text", "cat" ] }, "text": { "type": "object", "properties": { "text1": { "type": "string", "title": "Text1" }, "text2": { "type": "string", "title": "Text2" } } }, "category": { "type": "string", "title": "Category", "enum": [ "Geography", "Entertainment", "History", "Arts", "Science", "Sports" ] } }, "form": [ { "type": "selectfieldset", "key": "choice", "title": "Make a choice", "titleMap": { "text": "Search by text", "cat": "Search by category" }, "items": [ { "key": "text", }, { "key": "category" } ], }, { "type": "submit", "value": "Submit" } ], "customFormItems": { "text.text1": { "append": "today", "disabled": true }, "text.text2": { "append": "tomorrow" } } }
— Reply to this email directly or view it on GitHub https://github.com/ulion/jsonform/issues/23.
Ulion
You are more likely to be right about this than I am :)
currently, you can use readonly as a workaround. since the selectfieldset operate on fields with disable/enable operations, it probably does not consider the disabled true case. PR is welcome if anyone want to fix it.
2015-08-17 14:20 GMT+08:00 epitomus [email protected]:
You are more likely to be right about this than I am :)
— Reply to this email directly or view it on GitHub https://github.com/ulion/jsonform/issues/23#issuecomment-131692150.
Ulion