Created
December 4, 2018 18:55
-
-
Save fininhors/104fb1a44ef16c51ae1ef9ddc558eb56 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function validaCamposForm() { | |
| var vSAlerta = "Erros ocorreram durante o envio de seu formul\xe1rio.\n\nPor favor, fa\xe7a as seguintes corre\xe7\xf5es:\n"; | |
| var vSErro = 'N'; | |
| var elements = document.getElementsByClassName('obrigatorio'); | |
| for(var i = 0; i < elements.length; i++) { | |
| if ((elements[i].tagName == "INPUT") || (elements[i].tagName == "TEXTAREA")) { | |
| if(elements[i].title != "") { | |
| if(!elements[i].value || elements[i].value == "0") { | |
| var vSErro = 'S'; | |
| vSAlerta += "\n* O campo "+elements[i].title+" deve ser preenchido."; | |
| } | |
| } | |
| } | |
| if ((elements[i].tagName == "SELECT") && elements[i].title != "" ) { | |
| if(!elements[i].value || elements[i].value == "0") { | |
| var vSErro = 'S'; | |
| vSAlerta += "\n* No campo "+elements[i].title+" deve ser selecionado ao menos uma opção."; | |
| } | |
| } | |
| } | |
| return vSErro+"#"+vSAlerta; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment