Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function validaremail(executionContext) {
- var formContext = executionContext.getFormContext();
- var campoAValidar = formContext.getAttribute("emailaddress1").getValue();
- // ======================== VALIDAR EMAIL
- // Campo vacío, contener @,
- if (campoAValidar === null) {
- return "El correo no puede estar vacío.";
- }
- // Contener @ (mejorar a que sea solo una)
- if (campoAValidar.search("@") === -1) {
- formContext.getControl("emailaddress1").setNotification("El email debe contener una @");
- } else {
- formContext.getControl("emailaddress1").clearNotification();
- }
- // método test para recorrer string
- if (/^[@#$%^&*!]/.test(campoAValidar)) {
- formContext.getControl("emailaddress1").setNotification("El email no debe empezar con @ o símbolos raros");
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement