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

rescan() method changes field orig value if it was empty #123

Open
SYTDeath opened this issue Dec 20, 2016 · 1 comment
Open

rescan() method changes field orig value if it was empty #123

SYTDeath opened this issue Dec 20, 2016 · 1 comment

Comments

@SYTDeath
Copy link

    var rescan = function() {
      var $form = $(this);
      var fields = $form.find(settings.fieldSelector);
      $(fields).each(function() {
        var $field = $(this);
        if (!$field.data('ays-orig')) {
          storeOrigValue($field);
          $field.bind(settings.fieldEvents, checkForm);
        }
      });
      // Check for changes while we're here
      $form.trigger('checkform.areYouSure');
    };

Above is the rescan method. On line 6, the expression returns true if

  • the field's data attribute (ays-orig) is undefiend, or

  • the field's value is empty

In reality, fields may be empty when page is loaded for the first time. Running this method will lose the original ays-orig values of those fields.

Is there any reason why empty fields have to update their ays-orig values?

@sb-relaxt-at
Copy link

Just found this bug too. From my point of view checking for undefined seems to work.

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

2 participants