Ticket #348 (closed defect: fixed)
Initial value of case-control doesn't work
| Reported by: | sdm | Owned by: | mpo |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.4 |
| Component: | modules/kauri-forms | Version: | trunk |
| Keywords: | Cc: | kauri-discuss@… |
Description
I've tried to set the initial value of a case-control in 3 ways:
1) Setting the initial value of the case-control itself doesn't seem to work:
"control": {
"base": "case-control",
"nullable": true,
"null-text": "--- please select ---",
"initial": {"value": {"case":"n"}, "enable": true}
}
2) Setting the initial value of the selection-control which allows to make the choice between Text or Number doesn't work either:
"text-num-choice": {
"base": "string",
"label": "",
"control": {
base: "selection-control",
initial: {value: "n"}
}
}
3) Setting the initial value with setWireValue works, but only if the control block is not present (or commented out):
/*"control": {
"base": "case-control",
"nullable": true,
"null-text": "--- please select ---",
"initial": {"value": {"case":"n"}, "enable": true}
}*/
caseForm.getChild("tn").setWireValue({'case':"n", 'value':5},true);
The attached XML file contains the case-control sample page with the above tests to set the initial value.
Attachments
Change History
Changed 3 years ago by sdm
- Attachment case-control.html.xml added
comment:1 Changed 3 years ago by mpo
Investigated some.
The bug is tied to the fact that the control is made 'nullable'
(if it is not nullable, then things just work as expected, ie by using syntax in case 1)
The offending line was introduced in r1466 which ties it to #219 and r1471.
Further work needed, testing of #219 should be included.
comment:2 follow-up: ↓ 3 Changed 3 years ago by freya
- Status changed from new to closed
- Resolution set to fixed
solved in r1628
comment:3 in reply to: ↑ 2 Changed 3 years ago by sdm
- Status changed from closed to reopened
- Resolution fixed deleted
When testing the case-control sample page in FF/IE/Chrome, the following error occurs:
this.getChild("value") is undefined
this.getChild("value")[set...dName](value["value"], noValidation);
The case-control also seems disabled by default.
case-control sample page with some attempts to set the initial value