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 it possible to use a variable for validation? #55

Closed
muchacho-diesel opened this issue Jan 30, 2017 · 4 comments
Closed

Is it possible to use a variable for validation? #55

muchacho-diesel opened this issue Jan 30, 2017 · 4 comments

Comments

@muchacho-diesel
Copy link

muchacho-diesel commented Jan 30, 2017

Can I use a variable to validate? See example below:

data: function () {
    return {
        variable: 10
    }
},
validations: {

    form: {
        example: {
            between: between(this.variable, 400)
        }
    }
},
@Frizi
Copy link
Contributor

Frizi commented Feb 2, 2017

Yes, it's possible. You just have to enclose it into another function.

example: {
    between (value) {
        return between(this.variable, 400)(value)
    }
}

@ChrisRobston
Copy link

Not working!

@ChrisRobston
Copy link

@Frizi what is value in your example? Why this is not working?

maxLength () {
        return maxLength(this.countProp)
      }

@joelpro2
Copy link

joelpro2 commented Feb 12, 2019

@ChrisRobston you can do that like this

validations () {
    return {
        textfieldValue: {
            required,
            maxLength: maxLength(this.countProp)
        }
    }
}

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

4 participants