Skip to content

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

@nigini

Description

@nigini

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions