bmk's avatar
Level 1

Statamic Precognition form validation issue

I am trying to validate this form using the Statamic docs, however I am stuck and not sure how to proceed. I have alread installed laravel-precognition-alpine and imported it into the site.js

import Alpine from 'alpinejs';
import Precognition from 'laravel-precognition-alpine';

Alpine.plugin(Precognition);
Alpine.start();

This is the form that when I try to submit it empty, or with data populated it prompts 422 (Unprocessable Content) as well as AxiosError {message: 'Request failed with status code 422', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}

However if I use plain object, then it only prompts the 422 response for an empty form, and saves the data.

1 like
0 replies

Please or to participate in this conversation.