简体   繁体   中英

How does Webix implement hidden text controls to enforce rules

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM