-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
netteForms.js: Set validation result CSS classes #64
base: master
Are you sure you want to change the base?
Conversation
I like it. Best part is you've essentialy created hooks that can be overriden with custom functions. |
src/assets/netteForms.js
Outdated
return true; | ||
}; | ||
|
||
|
||
Nette.markControlValid = function(elem) { | ||
Nette.switchClass(elem, 'control-invalid', 'control-valid'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have nette
namespace.
131f7d2
to
532059a
Compare
This PR should be without any BC break. Adds CSS classes according to validation result of each control. Classes are prefixed with Functions can be overridden with custom ones ( So with this, on target system we can easily style valid/invalid form controls or add custom code executed for validation results. |
a57a557
to
55d0eb8
Compare
9e359e6
to
fa84d63
Compare
3c1619a
to
31bc0a3
Compare
6b04b51
to
d1c30d6
Compare
fd381fb
to
b70e5da
Compare
c996b4c
to
c8f4f95
Compare
144695c
to
c5c8bef
Compare
49c38f3
to
c6f98c1
Compare
337f707
to
2146e59
Compare
94f43f0
to
fe374c5
Compare
cb844f0
to
1d8a434
Compare
Sometimes it's useful visually distinguish valid/invalid inputs.
We use something like the code in this PR.
When we need to use another CSS classes or something absolutely different, it's possible redefine
Nette.markControlValid
andNette.markControlInvalid
.But I don't know if the PR should be accepted.
Also without it we can redefine
Nette.validateControl
, call original backed-up function and handle the result.So most likely this will be closed without merge.
But I can try it and listen your opinions.