Are there any docs about the JavaScript side?
- bernhard
- Member | 51
Hello everyone,
I've read somewhere that you can revalidate fields on the client side Using NetteForms.init(myElement)
But I can't find docs about that anywhere? I also did not find that .init() method in code, but that might be a lack of JS wisdom :D
I actually want to show a custom error during runtime when the user inputs non-allowed characters, but I want that error to be shown instantly and not after leaving the field.
Ok I'll maybe try to trigger NetteForms.init() in every “input” of the field. But the question regarding the docs remains :)
Thx!
- materix
- Backer | 83
Hi Bernhard,
According to https://doc.nette.org/…s/validation#…
is should be netteForms.initOnLoad()
, right?
- m.brecher
- Generous Backer | 864
@materix
Hi, the NetteForms.init(myElement) which @bernhard mentioned in his post is a different idea than netteForms.initOnLoad() mentioned in the documentation. @bernhard needs to change the function of Nette javascript validation “I want that error to be shown instantly and not after leaving the field”, he saw somewhere on internet that maybe NetteForms.init(myElement) can solve this, but such a function isn´t in nette/forms/…/netteForms.js. The function netteForms.initOnLoad() is only initialization of the validation script after loading the page, so something different.
@bernhard
The function NetteForms.init(myElement) isnt in the source code of netteForms.js, so probably if you would like to have instant validation based on key input or change event of one single form inpout, you should write such a function yourselves. I have tried to search some notes about this function on internet but found anything.
- mskocik
- Member | 61
m.brecher wrote:
The function NetteForms.init(myElement) isnt in the source code of netteForms.js, so probably if you would like to have instant validation based on key input or change event of one single form inpout, you should write such a function yourselves. I have tried to search some notes about this function on internet but found anything.
There is live form validation library from contributte, which extends NetteForms (overrides). It's quite customizable so it should be perfect fit for most use cases.