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

Support replacer functions on validations #1363

Closed
iamdual opened this issue Oct 27, 2018 · 5 comments
Closed

Support replacer functions on validations #1363

iamdual opened this issue Oct 27, 2018 · 5 comments
Labels
bug Verified issues on the current code behavior or pull requests that will fix them missing feature Reported issue which is not a bug but needs to be implemented
Milestone

Comments

@iamdual
Copy link

iamdual commented Oct 27, 2018

In CodeIgniter 3, this was a feature. We could add replacer functions (such as trim and strtolower) to the validations as a rule. Will you support this?

Example:
required|min_length[3]|max_length[32]|is_unique[users.username]|trim|strtolower

@InsiteFX
Copy link
Contributor

This should be asked in the CodeIgniter Forums not here, this is for reporting bugs only.

@jim-parry
Copy link
Contributor

Those should already be usable with CI4's validation, as "callable" rules. I don't see that clearly explained in the user guide, though it seems to be alluded to in the last section on the page, as part of a "note".
Have you tried to use any of these? This could be a case that the user guide needs a better explanation, or that the native functions need better support.

@iamdual
Copy link
Author

iamdual commented Oct 27, 2018

Yes, functions working on validations but the request output still same as user's request. CI3 do replace them. In CI4, I need to replace it again before adding to the database.

@jim-parry jim-parry added the bug Verified issues on the current code behavior or pull requests that will fix them label Oct 27, 2018
@jim-parry jim-parry added this to the 4.0.0 milestone Oct 27, 2018
@jim-parry jim-parry added the missing feature Reported issue which is not a bug but needs to be implemented label Oct 27, 2018
@lonnieezell
Copy link
Member

Ah - well no, that was done on purpose. These rules are for validation, not sanitation. While it may have been a convenient thing, that is no longer possible in v.4.

At least that was the original intent when I rewrote this library. That muddies that concerns, is an SRO violation and makes the code less clear about what is being done to what. Unless you really want this in here @jim-parry I vote to keep it out.

@jim-parry
Copy link
Contributor

Makes sense. Developers can trim or convert case independent of validation.
I'm fine with not proceeding with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them missing feature Reported issue which is not a bug but needs to be implemented
Projects
None yet
Development

No branches or pull requests

4 participants