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

Add support for Laravel 6.x email rules #476

Open
yangm97 opened this issue Jul 28, 2020 · 4 comments
Open

Add support for Laravel 6.x email rules #476

yangm97 opened this issue Jul 28, 2020 · 4 comments

Comments

@yangm97
Copy link

yangm97 commented Jul 28, 2020

Opening so I don't forget about this, details to come.

Basically if you have something like this in your FormRequest.php:

            'email' => 'required|email:rfc,dns,filter',  

The generated frontend code from this package doesn't attempt to validate to use other rules (such as dns and filter).

I guess the solution would be to make a request to the back end to validade this, but I just discovered this project today so I could be wrong :D.

@bytestream
Copy link
Collaborator

Looks like an outdated email rule implementation -

Email: function(value, element) {

It's only validating the input email against a regex - https://jqueryvalidation.org/email-method/

Support for rfc, dns, filter etc was added in Laravel 6.x

I've marked this as a feature request.

@bytestream
Copy link
Collaborator

It would be preferable if it could be implemented at JS level. That said, given the reliance on third-party PHP lib and differences in between PHP+JS regex implementations, I'm not sure what's worse, duplicating regexes into JS and having to maintain them (to keep up with the PHP lib), or having to make another AJAX request.

The main motivation is to do with this lib is to do whats possible at JS level, otherwise it would be quite simple to just make all rules fire an AJAX request.

@yangm97 yangm97 changed the title Not evaluating email rules aside from rfc Add support for Laravel 6.x email rules Jul 30, 2020
@yangm97
Copy link
Author

yangm97 commented Jul 30, 2020

Thanks @bytestream ! I guess it makes sense to do rfc validation on the client side since it's a standard so any differences between implementations should be seen as bugs on either side.

As for the other rules, think it would make sense to do the AJAX requests since they're pretty much PHP lib specific, but it shouldn't be much of concern since the default email rule is rfc, so, by default, this lib wouldn't make those AJAX requests.

@bytestream
Copy link
Collaborator

Hey @yangm97 you could try #505 on the dev-form-requests branch. I've converted it to a single AJAX requests so all validation is handled by Laravel. It seems OK from some usage in my app but needs some more testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants