Semantic-ui: [Form Validation] JS error when revalidating inputs without defined validation rules

Created on 29 Aug 2016  路  4Comments  路  Source: Semantic-Org/Semantic-UI

In our tests, we often get this error:
Uncaught TypeError: Cannot create property 'identifier' on boolean 'false'

From this code:

field: function(field, fieldName) {
...
            if(!field.identifier) {
              module.debug('Using field name as identifier', identifier);
              field.identifier = identifier;
            }

This happens when there are no validation rules defined and function argument field gets the value false. Most definitely, this condition should be checked.

          change: function(event) {
              var
                $field      = $(this),
                $fieldGroup = $field.closest($group),
                validationRules = module.get.validation($field) // FALSE RETURNED FROM HERE
              ;
              if(settings.on == 'change' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) ) {
                clearTimeout(module.timer);
                module.timer = setTimeout(function() {
                  module.debug('Revalidating field', $field,  module.get.validation($field));
                  module.validate.field( validationRules ); // FALSE PASSED HERE
                }, settings.delay);
              }
            }
Confirmed Bug

All 4 comments

4221

There should be a check

@jlukic should fix the validate error when there is search dropdown in form.

Was this page helpful?
0 / 5 - 0 ratings