Ticket #400 (closed task: fixed)
Disable element in case does not work for atomic element
| Reported by: | idbr | Owned by: | mpo |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.4 |
| Component: | modules/kauri-forms | Version: | |
| Keywords: | Cc: |
Description
In a case-control, disabling a composite in a case works, but if the case is a single element, it doesn't (in r1792).
For example, change the case-control sample as follows:
"cases": {
"t" : {
"base": "string",
"label": "Text",
"+validators": { "required": {} },
"control": {
"base": "input-control",
"initial": {
"value": "Enter text",
"enable": false
}
}
},
"n" : {
"base": "composite",
"label": "Number",
"control": {
"initial": {
"enable": false
}
},
"members": {
"test": "string",
"test2": "integer"
}
}
}
You'll notice that for case Text, the input field is enabled, and for the Number case, both input fields are disabled.
Change History
comment:2 Changed 2 years ago by karel
- Owner changed from mpo to karel
- Status changed from new to assigned
More info:
- When you add an initial value to the composite element, it isn't disabled either. (eg. value: {test:"hello", test2:10})
- However, when you remove the initial value from the single element case the problem persists (i.e. it doesn't become disabled like the no-value composite)
comment:3 Changed 2 years ago by karel
(In [1799]) Resetting a case control should also reset its valueControls.
see #400.
This fixes the problem adressed in the main ticket's description, but another problem persists:
If you add an initial value to the AbstractContainerControl?, reset() is called on the composite case control,
causing it to be visible at startup.
comment:4 Changed 2 years ago by karel
- Owner changed from karel to mpo
Ressigning to mpo for remaining problem. Please review this suggested fix:
Remove the if/else and leave these two lines (in this order):
Control.reset(me); me.eachChild(AbstractContainerControl.childReset);