[ARCHIVED] Trying to add validation to the default Email text box with Custom JS

Jump to solution
canvas_support6
Community Explorer

Hi All,

   We have a requirement to add additional formatting rules to the email passed through the registration page. We need to confirm that the email has our domain name and is not using a particular uid. 

   I have created my own html text input, set the Catalog email text box display to none and want to pass through the only the input that meets our requirements. I would like to the default error messages to invoke as usual when an invalid email is passed. I find I can populate the field with .value, but don't get the error message.

I have set

emailInputElement.style.display="none";
emailInputElement.tabIndex=-1;

....

emailInputElement.value = " ";
emailInputElement.click();

anotherElementWithFocus.focus();

Any recommendations?

Thanks,
Simon
Labels (1)
0 Likes
1 Solution

I resolved the issue with this

displayRMTIEmailErrorMessage(theTextInput);
setTimeout(() => {
    theTextInput.childNodes[0].focus();
    }, 20);

View solution in original post