Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Cannot read property 'errorImage' of undefined #49

Open
futuretechmag opened this issue Apr 15, 2017 · 6 comments
Open

Cannot read property 'errorImage' of undefined #49

futuretechmag opened this issue Apr 15, 2017 · 6 comments

Comments

@futuretechmag
Copy link

It looks like stepy is throwing:

$(step.find(':input:enabled').get().reverse()).each(function() {
        var fieldIsValid = $validate.element($(this));

        if (fieldIsValid === undefined) {
          fieldIsValid = true;
        }

        isValid &= fieldIsValid;

        if (isValid) {
          if (self.opt.errorImage) { <--- This line
            $title.removeClass('stepy-error');
          }
        } else {
          if (self.opt.errorImage) {
            $title.addClass('stepy-error');
          }

          $validate.focusInvalid();
        }
      });

Frankly, I'm unsure what I'm doing on my form setup that would cause this?

@wbotelhos
Copy link
Owner

Strange, opt is your hash configuration it is mandatory to the whole plugin work.
Try to debug the self.opt before the each function, it must be there.

@futuretechmag
Copy link
Author

I'm unsure what you mean exactly?

This is the total trace:

Uncaught TypeError: Cannot read property 'errorImage' of undefined at HTMLButtonElement.<anonymous> (stepy.min.js:367) at Function.each (jquery.min.js:2) at n.fn.init.each (jquery.min.js:2) at n.fn.init.validate (stepy.min.js:357) at HTMLButtonElement.<anonymous> (stepy.min.js:160) at HTMLButtonElement.dispatch (jquery.min.js:3) at HTMLButtonElement.r.handle (jquery.min.js:3)

I suppose my question is, what exactly is Stepy trying to read the property "errorImage" ON? In other words, "what" exactly is undefined?

@wbotelhos
Copy link
Owner

self.opt is undefined, you need to debug to know where it became undefined.

@meliborn
Copy link

Got the same issue. It's because on the first step self is an array of forms with one element self[0].opt return correct configuration. On the next steps it works with self.opt.

@wbotelhos
Copy link
Owner

Hi @meliborn ,

If you use the code of the master it still breaks?
We holding to release a new version soon, but some thing were changed: https://github.com/wbotelhos/stepy/blob/master/changelog.md

@meliborn
Copy link

meliborn commented Apr 24, 2018

@wbotelhos I've tried master version, but encountered some issues.

  1. Calling .stepy('step', 2) doesn't trigger next callback.
  2. Is <legend> tag required? Getting errors without it.
  3. Could you provide an example of validation please? It doesn't work with previous settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants