0

使用form-io. 我有select字段defaultValueas,

{
                    "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。现在我得到了labelsfor 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??

4

1 回答 1

0

反对,然后它起作用了valuedefaultValue

于 2019-12-09T06:05:14.680 回答