Skip to content
This repository has been archived by the owner on Dec 25, 2017. It is now read-only.

How to disabled submit button on page init #354

Open
baiyunchen opened this issue Jan 23, 2017 · 2 comments
Open

How to disabled submit button on page init #354

baiyunchen opened this issue Jan 23, 2017 · 2 comments

Comments

@baiyunchen
Copy link

Vue Version:Vue 2.0
Vue-Validator Version:v3.0.0-alpha.2
when page init $validation is empty object,if i bind :disabled="reasonInvalid" to submit button,this can not work on page first init.
How can I solve this problem?

@gavrashenko
Copy link

This demo can helps a little: vue-validator/examples/timing/index.html
But: demo have some issue. If one of the fields is a valid - submit button will become active.
Maybe you should add array to the data with all your validity fields, and mark them as valid/invalid durings validation (inside handleInput method), and unlock your submit button after all fields will become isValid: true

@baiyunchen
Copy link
Author

@gavrashenko I think vue-validator need provider an API that can be invoked before submit it to obtain the validation results,this is be best practice.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants