data-nette-rules JS validation
- SysFail
- Member | 2
Hello there!
I currently am having some trouble with the validation of a captcha-like field in one of my forms.
I don't want it to be validated via JS, I rather it to be done on the server (obvious reasons) and I was wondering what would be the best way to prevent nette from sending the validation value through the data-nette-rules html tag.
It actually does it because I created a Rule (EQUAL) for that input at form creation stage that gets the needed value from the captcha-like engine so the code looks really neat and tidy.
I have thought about writing form header and footer manually on the template, but I am not sure about the existence of any function or property to modify JS validation or attributes within the <input> tag.
¿Any clues, advices or style issues?
Thanks for your attention.
- SysFail
- Member | 2
Thanks for your prompt answer!
I followed your approach and fits perfectly my purposes.
Just for the record, instead of defining the validation function within the addRule call, I defined it on my model layer and then, I passed it to the addRule function as it would be done with a PHP standard callback: $function = array(‘myClass’, ‘myStaticFunction’);
Thank you very much, sir.