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

How to use _beforeSubmit with Vue.JS #113

Open
kiwo12345 opened this issue Jul 12, 2019 · 0 comments
Open

How to use _beforeSubmit with Vue.JS #113

kiwo12345 opened this issue Jul 12, 2019 · 0 comments

Comments

@kiwo12345
Copy link

kiwo12345 commented Jul 12, 2019

In order for me to prevent the form from being posted before validated I have to use the _beforeSubmit() function.

But how can I implement it in Vue.js? I am using the vee-validate lib for validating but I am now sure how I should use beforeSubmit with it.

_beforeSubmit = function() {
    
      return false;
  }

Works fine in a vanilla js file, but how should I implement it in my vue.js file?

vue ///
methods: {
    onSubmitLogin(scope) {
      this.submittedLogin = true;
      this.$validator.validateAll(scope).then((result) => {
          if (result) {
            console.log("ok");

            $('#login-form').submit();

          } else {
            // validation failed
            console.log("validation errors");
            return false;
          }

        })
        .catch((error) => {
          console.log(error);
        });
    },

Or is there any way I can manually toggle the validation for the recaptcha inside vue? Then I could run the reCaptcha validation after my vue validation

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