uploader required true script error

When required is true in the uploader component a script error is raised, See https://snippet.webix.com/su2imywo

Uncaught TypeError: Cannot read property 'isNotEmpty' of undefined
at u.validate (validatedata.js:103)
at u.click (ImportMembers:40)
at Object. (core.js:357)
at Object.callEvent (eventsystem.js:56)
at y (customevents.js:7)
at HTMLBodyElement. (ready.js:56)

Tagged:

Comments

  • Hello @mdissel,
    Please note that ui.uploader doesn't have required:true property. This setting is used for form inputs. Therefore, you need to add separate rule:

    rules:{
          "files":webix.rules.isNotEmpty
        },
    

    Please take a look at the snippet:
    https://snippet.webix.com/3tetx8oi

  • May I suggest a feature request? To be consistent with all the other form components.

  • @mdissel
    also you can set validate:webix.rules.isNotEmpty instead of required:true

  • Thanks, the form elements are rendered to json with a serverside (c#) library. A single property for the same purpose is easier ;)

  • A single property for the same purpose is easier

    a hack is possible

    webix.extend(webix.ui.uploader, {
      $init: function(config){
        if(config.required && !config.validate){
          config.validate = webix.rules.isNotEmpty;
        }
      }
    });
    

    https://snippet.webix.com/76175jau

  • Thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!