[Vuejs]-Bootstrap-Vue + Vuelidate: "Dialog" for creating and updating data

0👍

The solution is to change the validators like this, in my case to be able to edit a password a section opens up using the variable visible so only when that section is visible it will require the new password, if the section is not visible then the password doesn’t require being changed.

    validations: {
        form: {
            password: {
                required: requiredIf(function (pass) {
                    return !this.form.id
                }),
            },
            password_confirmation: {
                required: requiredIf(function (pass) {
                    return !this.form.id
                }),
                sameAsPassword: sameAs('password')
            },
            password_edit: {
                required: requiredIf(function (pass) {
                    return this.form.id && this.visible
                }),
            }
        }
    },

Leave a comment