Ticket #250 (closed defect: fixed)
selection-control with valueTemplate which contains value '0'
| Reported by: | sdm | Owned by: | mpo |
|---|---|---|---|
| Priority: | critical | Milestone: | 0.4 |
| Component: | modules/kauri-forms | Version: | trunk |
| Keywords: | Cc: |
Description
This is the selection-control configuration:
'abcId' :{
base: 'integer',
control: 'abc-control',
'+validators' : { 'required' : {message: 'Required!'}}
}
...
'abc-control': {
base: 'selection-control',
options : {
uri: '${publicUri('service:/router')}/abc/all',
valueTemplate: '{id}',
labelTemplate: '{label}',
nullable: true,
"null-text": '--- Choose abc ---'
}
}
If the JSON result from the server is something like this:
[{"id":0,"label": "A"}, {"id":1,"label": "B"}]
which contains an id '0', the following HTML gets rendered:
<option value="">A</option> instead of <option value="0">A</option>
'abcId' contains a required field validator, and the value of A is empty, so you can't select A because then the required field validator shows up, indicating that you didn't select a value.