Ticket #369 (closed defect: worksforme)
Using integer values for a selection control
| Reported by: | bc | Owned by: | mpo |
|---|---|---|---|
| Priority: | major | Milestone: | 0.4 |
| Component: | modules/kauri-forms | Version: | |
| Keywords: | Cc: | kauri-discuss@… |
Description
When using a selection-control, you have to specify the value in the JSON as a string, so when you build the json, you have to convert any integer (or other) values to a string because otherwise the correct value is not shown.
e.g. for fconf
'my-control': {
base : "selection-control",
label: "status",
options : {
uri: publicUri + "/business/code/maandstatus/" + admin.id,
valueTemplate: "{code}",
labelTemplate: "{langeText}"
}
}
the json-string [{"code":5, "value":"value 5"},{"code":8, "value":"value 8"}]
won"t work, it has to be [{"code":"5", "value":"value 5"},{"code":"8", "value":"value 8"}]
Change History
comment:2 Changed 3 years ago by mpo
Spend some time to understand the issue here:
"otherwise the correct value is not shown"
is in case of using setValue/setWireValue or reset() (initial.value)
right?
comment:3 Changed 3 years ago by mpo
Spend some more time and even the setValue cases work on my end.
I've added a test to the selection-sample page (r1722)
Could you please verify and close this issue (can't reproduce) or clarify your case?
comment:4 Changed 3 years ago by bc
The problems occures with the carMakesNullable-field
Using the selection control sample,
when you add the following
var x = theform.findControl("carMakesNullable");
x.setWireValue("2");
You see that "Renault" is selected
but when you say
x.setWireValue(2);
the value is "---please select---" so I assume no value is set for the selection control and so, the first item in the list is shown.
comment:5 Changed 3 years ago by mpo
from the sample at:
http://dev.outerthought.org/trac/outerthought_kauri/browser/trunk/samples/kauri-forms-sample/src/main/kauri/pages/selection-control.html.xml
line 99
99 "carMakesNullable": {
100 "base": "string",
I think that is your explanation, no?