laravel/precognition

form.submit with validate array does not work

cliff-paqt opened this issue · 6 comments

Laravel Precognition Plugin Version

0.3.1

Laravel Version

10.0

Plugin

Vue

Description

I would like to add which fields on the form should be validated on submit. I would expect that populating the optional validate property with an array of paths would do this.
e.g.

@change="form.validate('assets.0.address.zipcode' )"
works

but this doesn't:

const submit = () => {
    form.submit({
        validate: ['assets.0.address.zipcode', 'assets.0.address.number'],
    });
};

Steps To Reproduce

add the code as mentioned in the description to your form
change the name(s) in the array of thevalidate property
See that it validates the whole form, instead of just the given names ('assets.0.address.zipcode', 'assets.0.address.number')

@cliff-paqt it is not possible to do this as a "submit" request is not a precognition request.

You would need to handle this on the back end yourself.