Skip to content

Disable Validation for Save as Draft #3958

Answered by aronduby
aronduby asked this question in Q&A
Discussion options

You must be logged in to vote

After lots of digging and some minor refactoring I was able to get this working. The key was changing from field based rules and validation to form based since the validationSchema is reactive. Then I can just change the schema to false to make the form skip validation when it's a draft.

My setup script now looks like the following:

import { useForm } from "vee-validate";
import { computed, reactive } from "vue";

const submissionValidation = {
    'consult_patient_name': 'required|min:5',
    'item_name': 'required|min:2',
    'consult_question': 'required|min:5',
    'consult_history': 'required|min:5',
};

// if it's a draft set it to false, so it can bypass validation
// otherwise set…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@logaretm
Comment options

Answer selected by aronduby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants