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

Call default validation within custom validation #405

Closed
Ruud-cb opened this issue Dec 23, 2016 · 2 comments
Closed

Call default validation within custom validation #405

Ruud-cb opened this issue Dec 23, 2016 · 2 comments
Labels
feature New feature
Milestone

Comments

@Ruud-cb
Copy link
Contributor

Ruud-cb commented Dec 23, 2016

Requirement:
Have a number of default filter rules setup, all having the contains as operator. Empty values are allowed and should not be filtered on if it is empty.

Unfortunately, the plugin doesn't allow me to get the rules if 1 or more of the rules have an empty value.

From the documentation, I can do a few things:

  • Let the plugin decide the validation
  • Provide own input validation format and messages
  • provide a callback function to do the validation.

Now the only thing I want to do:
Check if it is empty, if it is NOT empty, execute the default validation. If it IS empty, just validate it, filtering on empty values will be handled server-side.

What I would like to have is either:

  • A property in the filter settings, indicating empty values are allowed, something like: allow_empty_value. There is an allow_empty, but that only allows an empty builder).
  • In the custom validation, a callback to the default validation. (Couldn't find it so far, maybe it is there already? Looking at the code I would like to call validateValueInternal, not sure if that can be done in a non-hacky-way.

Thanks!

@mistic100 mistic100 added the feature New feature label Dec 23, 2016
@mistic100 mistic100 added this to the 2.4.1 milestone Dec 23, 2016
@mistic100
Copy link
Owner

The callback is binded to this so you can directly call this.validateValueInternal.

I will add an allow_empty_value filter property

@Ruud-cb
Copy link
Contributor Author

Ruud-cb commented Dec 27, 2016

that would be perfect! Thanks

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

No branches or pull requests

2 participants