使用form-io
. 我有select
字段defaultValue
as,
{
"authenticate": false,
"hidden": false,
"data": {
"values": [{
"label": "New",
"value": 1
}, {
"label": "In Progress",
"value": 2
}, {
"label": "Resolved",
"value": 3
}, {
"label": "Feedback",
"value": 4
}, {
"label": "Closed",
"value": 5
}, {
"label": "Rejected",
"value": 6
}]
},
"defaultValue": "New",
"multiple": false,
"labelMargin": 3,
"tableView": true,
"clearOnHide": true,
"labelWidth": 30,
"label": "Status",
"autofocus": false,
"type": "select",
"input": true,
"protected": false,
"labelPosition": "left-right",
"unique": false,
"persistent": true,
"key": "ticket_status",
"dataSrc": "values",
"validate": {
"required": true
}
}
并点击按钮我必须得到那些value
。现在我得到了labels
for default set options
,而不是value
.Onsubmit
按钮点击我做如下,
Formio.createForm(document.getElementById('formio'), data,{
readOnly: false
}).then(function(form) {
form.on('submit', function(event) {
that.savingNewTicket(event.data);
});
});
但是当我选择任何其他选项时,value
正在提交,但对于defaultValue
设置选项,我得到的labels
不是value
。我怎样才能得到value
??