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

Error when using custom validation rules in Meerkat blueprint #239

Open
arkraieski opened this issue Apr 24, 2024 · 4 comments
Open

Error when using custom validation rules in Meerkat blueprint #239

arkraieski opened this issue Apr 24, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@arkraieski
Copy link

Hi, I'm not sure if this is a bug or unsupported functionality (or if it's possible I'm just doing something wrong), but as far as I can tell, custom Laravel validation does not work. I am on statamic 4.55.0 and meerkat 3.1.1

As a reproducible example, I followed the statamic and laravel docs in defining a custom Uppercase validation rule and referenced it in the meerkat blueprint yaml:

            handle: email
            field:
              type: text
              display: Email
              validate:
                - required
                - email
                - new App\Rules\Uppercase

Then, when I attempt to submit a comment, it throws an error:
ERROR: Method Illuminate\Validation\Validator::validateNewApp\Rules\Uppercase does not exist.

I confirmed that the same validation rule class worked with other (non-meerkat related) blueprints in my control panel.

My real use case for custom validation rules is that I am trying to prevent guest commenters from using email addresses that look like those of site administrators.

@JohnathonKoster
Copy link
Contributor

Hey there! I'll have to take a look to see if there is anything special I need to do on my end to also support this, as I haven't used the new validation rule style yet personally.

@arkraieski
Copy link
Author

Thanks! And does that mean the old Rule interface would work for this for now? I'm actually coming from the opposite side (never having used the the old style rule personally).

@JohnathonKoster
Copy link
Contributor

Doing some digging, it looks like I may have to add support for this explicitly. I'll let you know once that's available 👍

@JohnathonKoster JohnathonKoster added the enhancement New feature or request label Apr 26, 2024
@JohnathonKoster JohnathonKoster self-assigned this Apr 26, 2024
@JohnathonKoster
Copy link
Contributor

An update on this one. I'm going to delay this change until Meerkat 4 since it ended up being quite a significant change to how the underlying form handler works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants