Guest User

Untitled

a guest
Dec 13th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. function testeCampos(elemento) {
  2.  
  3. //Recebe lista de campos para valida��o
  4. var camposArray = new Array();
  5. camposArray = elemento;
  6.  
  7. //Recebe campo armazenado no array
  8. var campo, recFocu;
  9.  
  10. //Verifica se h� uma ocorrencia de erro
  11. var faltaPre = false
  12.  
  13. //varre o Array de Campos
  14. for (c = 0; c < camposArray.length; c++) {
  15.  
  16. //cria Objeto com o metodo DOM
  17. campo = document.getElementById(camposArray[c]);
  18.  
  19. if (campo.value == '') {
  20.  
  21. campo.style.backgroundColor = "#eeee99";
  22.  
  23. if (faltaPre != true) {
  24. faltaPre = true;
  25. recFocu = campo;
  26. }
  27. }
  28. else {
  29. campo.style.backgroundColor = "white";
  30. }
  31. }
  32.  
  33. if (faltaPre == true) {
  34. alert('Campo com Preenchimento obrigatxf3rio!!!');
  35. recFocu.focus();
  36. return false;
  37. }
  38. else {
  39. return true;
  40. }
  41. }
  42.  
  43. TextBox[] aTextbox = { txtNome, TxtEndereco, TxtCEP, TxtBairro, TxtUF, TxtCidade, TxtTelefone, txtUsuario, TxtSenha };
  44.  
  45. this.btnEnviar.Attributes.Add("onclick", "return testeCampos(aTextbox);");
Add Comment
Please, Sign In to add comment