Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. validar: function(e){
  2.  
  3. var t = this,
  4. errores = [];;
  5.  
  6. st.regexp.nombre.test(t.nombre) ? null : errores.push('Nombre');
  7.  
  8. if(t.empresa.length > 0){
  9. st.regexp.razon_social.test(t.empresa) ? null : errores.push('Empresa');
  10. }
  11.  
  12. if(t.email == '' && t.telefono == ''){
  13. errores.push('E-mail o teléfono')
  14. }else{
  15. if(t.email != ''){
  16. if(!st.regexp.email.test(t.email)){
  17. errores.push('E-mail')
  18. }
  19. }
  20.  
  21. if(t.telefono != ''){
  22. if(!st.regexp.tel.test(t.telefono)){
  23. errores.push('Teléfono')
  24. }
  25. }
  26. }
  27.  
  28. if(t.medio == null){
  29. errores.push('Selecciona un medio');
  30. }
  31.  
  32. st.regexp.texto.test(t.mensaje) ? null : errores.push('Mensaje');
  33.  
  34. if(errores.length > 0){
  35. var txt = '<ul class="st-no-list-style txt-14">';
  36. for(var i = 0, n = errores.length; i < n; i++){
  37. txt +='<li> <i class="fa fa-remove color-rojo"></i> '+errores[i]+'</li>';
  38. }
  39. txt += '</ul>';
  40.  
  41. 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>';
  42.  
  43. st.notificacion.abrir(ventana);
  44.  
  45. return;
  46. }
  47.  
  48.  
  49. this.enviar();
  50. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement