环境
托管类型
- [] 表单.io
- [x] 本地部署
Formio.js 版本:- 版本:4.9.26
前端框架:Angular 8+
浏览器:铬
浏览器版本:版本 83.0.4103.116(官方构建)(64 位)
预期行为
支持表单值的组(集体)设置defaultValue
。就像单个表单组件defaultValue
设置一样`
观察到的行为
neither `this.tempFormContent.defaultValue = formSavedData`
也不 this.tempFormContent.defaultValues = formSavedData
行
这是否没有记录或不受支持?
例子
<mat-formio [form]="projectFormContent" (submit)="onSubmit($event)"></mat-formio>
单独设置为默认值工作正常:
protected tempFormContent:any = {
"components": [
{
"label": "How do YOU define 1",
"spellcheck": true,
"tableView": true,
"validate": {
"unique": false,
"multiple": false
},
"key": "key1",
"type": "textarea",
"input": true,
"defaultValue": defValuekey1Saved,
description: "...."
},
{
"label": "How do YOU define 2",
"spellcheck": true,
"tableView": true,
"validate": {
"unique": false,
"multiple": false
},
"key": "key2",
"type": "textarea",
"input": true,
"defaultValue": defValuekey2Saved,
description: "...."
},
{
"type": "button",
"label": "Save and Next",
"key": "submit",
"disableOnInvalid": true,
"input": true,
"tableView": false,
"validate": {
"unique": false,
"multiple": false
}
}
]
};
//returning the value used in the HTML template
public get projectFormContent():any {
return this.tempFormContent;
但是是否有一些组默认设置,我已经尝试过了,但没有工作:
protected tempFormContent:any = {
"components": [
{
"label": "How do YOU define 1",
"spellcheck": true,
"tableView": true,
"validate": {
"unique": false,
"multiple": false
},
"key": "key1",
"type": "textarea",
"input": true,
// "defaultValue": defValuekey1Saved,
description: "...."
},
{
"label": "How do YOU define 2",
"spellcheck": true,
"tableView": true,
"validate": {
"unique": false,
"multiple": false
},
"key": "key2",
"type": "textarea",
"input": true,
// "defaultValue": defValuekey2Saved,
description: "...."
},
{
"type": "button",
"label": "Save and Next",
"key": "submit",
"disableOnInvalid": true,
"input": true,
"tableView": false,
"validate": {
"unique": false,
"multiple": false
}
}
]
};
//returning the value used in the HTML template
public get projectFormContent():any {
this.tempFormContent.defaultValue = {'defValuekey1':defValuekey1Saved, 'defValuekey2':defValuekey2Saved};
// this neither works:
// this.tempFormContent.defaultValues = {'defValuekey1':defValuekey1Saved, 'defValuekey2':defValuekey2Saved};
return this.tempFormContent;