Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- validar: function(e){
- var t = this,
- errores = [];;
- st.regexp.nombre.test(t.nombre) ? null : errores.push('Nombre');
- if(t.empresa.length > 0){
- st.regexp.razon_social.test(t.empresa) ? null : errores.push('Empresa');
- }
- if(t.email == '' && t.telefono == ''){
- errores.push('E-mail o teléfono')
- }else{
- if(t.email != ''){
- if(!st.regexp.email.test(t.email)){
- errores.push('E-mail')
- }
- }
- if(t.telefono != ''){
- if(!st.regexp.tel.test(t.telefono)){
- errores.push('Teléfono')
- }
- }
- }
- if(t.medio == null){
- errores.push('Selecciona un medio');
- }
- st.regexp.texto.test(t.mensaje) ? null : errores.push('Mensaje');
- if(errores.length > 0){
- var txt = '<ul class="st-no-list-style txt-14">';
- for(var i = 0, n = errores.length; i < n; i++){
- txt +='<li> <i class="fa fa-remove color-rojo"></i> '+errores[i]+'</li>';
- }
- txt += '</ul>';
- var ventana = '<div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4 color-blanco text-center"><h3 class="color-blanco">¡Hay algunas cosas por revisar!</h3><p class="txt-14">Corrige los siguientes campos e intenta de nuevo</p>'+txt+'</div>';
- st.notificacion.abrir(ventana);
- return;
- }
- this.enviar();
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement