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
Core: Add support for defining a global normalizer #1905
Conversation
Thx.🎄 |
Hi @Arkni |
Only one of them is executed which is the specific one. $("#myForm").validate({
// This will run for every element except for the ones that have their own normalizer.
// In our case, this will not run for `username` element.
normalizer: function globalNormalizer(value) {
return $.trim(value);
},
rules: {
username: {
required: true,
// Here, we override the global normalizer
normalizer: function usernameNormalizer(value) {
return value.toUpperCase();
}
},
fullname: {
required: true
}
}
}); |
@Arkni Got it. Thanks for the explanation and the nice work. Do you know about any schedule for the next release? Is next release going to have this feature? And if so when will that be ? |
There still some issues to be fixed before the next release. So, maybe after fixing them, we will do a minor release.
Yes
Same as answer 1. |
@Arkni |
Nice one. Any ETA on this feature? |
The new release was planned for the end of June but got postponed and the documentation is ahead of its time :) We will see if we can prepare a release the next week! //c @staabm |
That's nice.. how to subscribe for release alerts ? |
Subscribe to #2016 |
This PR added support for using a global normalizer for all elements of the form, which will run for all elements if it's present in the top level (the same level as
rules
) without affecting the current behaviour, that way you can transform the values of a set of elements without attaching the same normalizer to the aforementioned elements, and you can override it on element level by specifying a normalizer for the specific element that you want to transform differently.In pseudo code, this will look like: