Webix如何实现隐藏文本控件来强制执行规则



项目需求中有一个隐藏的text控件。文本由file upload的结果分配,但隐藏控件似乎不受规则规则的监视。样品如下

App.form={
elements:[
....
,{"cols": [
{id: "file_code", name: "file_code", view: "text", invalidMessage:"please upload file", hidden: true},
{id: "file_code_btn", view: "button", label: "select file", "width": 100, "inputHeight": 20},
]}
],
rules:{
"name": webix.rules.isNotEmpty
,"file_code": webix.rules.isNotEmpty
}

当我将hidden property更改为false时,我可以在前端实现非空检查,但在隐藏属性之后无法实现。

如果你能告诉我如何解决这个问题,我将不胜感激

默认情况下,在数据验证过程中会忽略隐藏字段和禁用字段
不过,您可以在validate调用中添加一个额外的参数,以包含它们

form.validate({ hidden: true })

https://docs.webix.com/desktop__data_validation.html#validationofhiddenanddisabledfieldsinform

最新更新