gitana/alpaca

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

Opened this issue · 0 comments

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.