Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Form Validation] JS error when revalidating inputs without defined validation rules #4497

Closed
cbxp opened this issue Aug 29, 2016 · 4 comments
Milestone

Comments

@cbxp
Copy link

cbxp commented Aug 29, 2016

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);
              }
            }
@wenweih
Copy link

wenweih commented Sep 9, 2016

#4221

@jlukic jlukic added this to the 2.2.5 milestone Sep 9, 2016
@jlukic
Copy link
Member

jlukic commented Sep 9, 2016

There should be a check

@wenweih
Copy link

wenweih commented Sep 9, 2016

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

cbxp pushed a commit to cbxp/Semantic-UI that referenced this issue Sep 12, 2016
@cbxp
Copy link
Author

cbxp commented Sep 12, 2016

We have a simple fix: #4547

@cbxp cbxp changed the title Frequent JS error in form validation JS error when revalidating inputs without defined validation rules Sep 12, 2016
@jlukic jlukic modified the milestones: 2.2.5, 2.2.6, 2.2.7 Oct 28, 2016
@jlukic jlukic changed the title JS error when revalidating inputs without defined validation rules [Form] JS error when revalidating inputs without defined validation rules Feb 20, 2017
@jlukic jlukic changed the title [Form] JS error when revalidating inputs without defined validation rules [Form Validation] JS error when revalidating inputs without defined validation rules Feb 20, 2017
jlukic added a commit that referenced this issue Feb 20, 2017
@jlukic jlukic closed this as completed Feb 20, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants