Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with async validation and wizard #98

Open
aalyusuf opened this issue Sep 11, 2024 · 0 comments
Open

Issues with async validation and wizard #98

aalyusuf opened this issue Sep 11, 2024 · 0 comments
Assignees

Comments

@aalyusuf
Copy link

Laravel Precognition Plugin Version

0.5.8

Laravel Version

11.0

Plugin

Vue w/ Inertia

Description

This is slightly similar to #95 but I'd like to highlight the issue I'm facing with wizard use-case.

In the below example from #69 & Laravle docs, onSuccess() wouldn't trigger if the inputs have already been validated

<Button 
    @click="form.touch(['name', 'email', 'address', 'phone']).validate({
        onSuccess: () => nextPage(),
        onValidationError: () => notify('You have validation errors'),
    })"
>
    Next
</Button>

This means we cannot mix @change="form.validate('any') on an input alongside the button because all of the would have all been validated.

Also makes it difficult to have a previous button in a wizard.

This would have been a quick/clean thing to solve if form.valid() can validate an array instead of one key at a time or to have onValid() in validate.

Steps To Reproduce

function nextStep() {

    const formElements = [
        ["first_name", "last_name"],
        ["email", "password"],

    ];

    form.touch(formElements[activeStep.value]).validate({
        onSuccess: () => {
            activeStep.value += 1;
        }
    });

}
@aalyusuf aalyusuf changed the title Wizard Issues with async validation and wizard Sep 11, 2024
@timacdonald timacdonald self-assigned this Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants