How does Webix implement hidden text controls to enforce rules

98 Views Asked by At

There is a hidden text control in the project requirement. The text is assigned by the result of the file upload, but the hidden control does not seem to be monitored by the Rule rule. The sample is as follows

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
    }

When I change the hidden property to false, I can realize the non-null check in the front end, but it cannot be realized after the hidden property.

I would appreciate it if you could tell me how to solve it.

1

There are 1 best solutions below

0
Aquatic On

By default hidden and disabled fields are ignored during data validation.
Though, you can add an extra parameter to the validate call to include them

form.validate({ hidden: true })

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