Expand my Community achievements bar.

How can I trigger validations on various input types on keyup rather than value commit?


Level 1

I have a text input field-- specifically a "guideTextBox"— where I am trying to trigger validations on "keyup" rather than "value commit"--

the reason I want to do that is because we have a continue button that is disabled until a series of inputs within the form are valid, and if we wait until the "value commit" event fires, the button is not enabled until blur, which is confusing to users (given that, thanks to angular/react/etc, users are used to seeing instant feedback when they perform an action).

Within the AEM Form Editor, there is no built-in event for keyup, so I have a custom script that, on initialization, uses jQuery to bind an event handler to keyup, and then I check the "isValid" property of the (guideTextBox) component.*

However, the isValid property only changes once the value is committed (on blur). I want to trigger those validations on keyup. There are methods (like "_runTests", "_runValidations", "validate", etc) on the guideTextBox prototype / Field / Scriptable classes,  but, being that they are not in any public documentation, I assume they are meant to be private methods... and also they do not work- meaning they do not change the isValid property of the component. The validationState also doesn’t change until value commit.

So, I am a developer who wants to trigger validations on keyup; how do I do this?

0 Replies