-
-
Save saulovenancio/f7bddcd4ca3bb95cd0edb6bcae63e6fb to your computer and use it in GitHub Desktop.
AEM Touch UI validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $input = $('.my-input-field'), | |
errorMessege = 'This field is required'; | |
if ($input.willValidate()) { | |
$input.checkValidity(); // true | |
$input.validationMessage(); // '' | |
/* Set input field as invalid */ | |
$input.setCustomValidity(errorMessage); | |
$input.checkValidity(); // false | |
$input.validationMessage(); // 'This field is required' | |
$input.updateErrorUI(); // displays red error icon | |
/* Set input field as valid */ | |
$input.setCustomValidity(null); | |
$input.checkValidity(); // true | |
$input.validationMessage(); // '' | |
$input.updateErrorUI(); // removes red error icon | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment