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

Is this a bug with the "valid" and "invalid" callbacks inside a View? #775

Open
nigini opened this issue Mar 24, 2023 · 0 comments
Open

Comments

@nigini
Copy link

nigini commented Mar 24, 2023

I have been using the validand invalidcallbacks to show and hide the 'NEXT' button in a software. When I use it as part of the view entry in a jquery call to alpaca -- i.e. $("#myForm").alpaca({ //here! }); it works pretty well, and only shows the button when ALL FIELDS are valid!

But I recently started playing around with creating a more complex view entity; but as soon as I move the same valid and invalid callback to this new view, they start being triggered as soon as ANY FIELD is found valid or invalid, so my button appears and disappears as I move through the fields!

Here is part of the view code:

Alpaca.registerView({
  "id": "MyAlpacaView",
  "parent": "bootstrap-create",
  "callbacks": {
    "valid": function () {
      $('#btn-next-page').attr('style', 'display:block;');
      $('#btn-next-page')[0].scrollIntoView();
    },
  }
});

Again, this doesn't work properly when I use MyAlpacaView in the creation of #myForm. The form appears but has the behavior I described above. But as soon as I move only the callbacks section there, it works nicely.

@nigini nigini changed the title Is this a bug with the "valid" and "invalid" callback? Is this a bug with the "valid" and "invalid" callbacks inside a View? Mar 24, 2023
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

1 participant