Código HTML:
<script type="text/javascript"> //Validacion de Registro function validar_registro() { var use1 = document.getElementById('username'); var pas1 = document.getElementById('password1'); var pas2 = document.getElementById('password2'); var nomb = document.getElementById('nombres'); var apel = document.getElementById('apellidos'); var corr = document.getElementById('correo'); var dire = document.getElementById('direccion'); var tele = document.getElementById('telefono'); var regreso = false; if(notEmpty("<?php echo $v_linea1; ?>",use1,"<?php echo $v_linea2; ?>")) { if(notEmpty("<?php echo $v_linea3; ?>",pas1,"<?php echo $v_linea4; ?>")) { if(notEmpty("<?php echo $v_linea3; ?>",pas2,"<?php echo $v_linea5; ?>")) { if(confirmar_claves("<?php echo $v_linea6; ?>", pas1, pas2, "<?php echo $v_linea7; ?>")) { if(notEmpty("<?php echo $v_linea8; ?>",nomb,"<?php echo $v_linea9; ?>")) { if(notEmpty("<?php echo $v_linea10; ?>",apel,"<?php echo $v_linea11; ?>")) { if(notEmpty("<?php echo $v_linea12; ?>",corr,"<?php echo $v_linea13; ?>")) { if(emailValidator("<?php echo $v_linea14; ?>", corr, "<?php echo $v_linea15; ?>")) { if(notEmpty("<?php echo $v_linea16; ?>",dire,"<?php echo $v_linea17; ?>")) { if(notEmpty("<?php echo $v_linea18; ?>",tele,"<?php echo $v_linea19; ?>")) { if(isNumeric("<?php echo $v_linea20; ?>", tele, "<?php echo $v_linea21; ?>")) { if(lengthRestriction_specific("<?php echo $v_linea22; ?>", tele, 11, "<?php echo $v_linea23; ?>")) { if(chequeo_boxes()) { return true; } } } } } } } } } } } } } return false; } function chequeo_boxes() { if (document.form1.tipo.checked) { var cedu = document.getElementById('documento'); var nomt = document.getElementById('nombrecuenta'); var banc = document.getElementById('idbanco'); var tipo1 = document.getElementById('tipocuenta'); var numc = document.getElementById('nocuenta'); if(notEmpty("<?php echo $v_linea24; ?>",cedu,"<?php echo $v_linea25; ?>")) { if(notEmpty("<?php echo $v_linea34; ?>",nomt,"<?php echo $v_linea35; ?>")) { if(madeSelection("<?php echo $v_linea27; ?>", banc, "<?php echo $v_linea26; ?>", "<?php echo $linea21; ?>")) { if(madeSelection("<?php echo $v_linea27; ?>", tipo1, "<?php echo $v_linea28; ?>", "<?php echo $linea21; ?>")) { if(notEmpty("<?php echo $v_linea29; ?>",numc,"<?php echo $v_linea30; ?>")) { if(isNumeric("<?php echo $v_linea31; ?>", numc, "<?php echo $v_linea32; ?>")) { if(lengthRestriction_specific("<?php echo $v_linea31; ?>", numc, 20, "<?php echo $v_linea33; ?>")) { return true; } } } } } } } return false; } else { return true; } } </script>
Código HTML:
//Funciones de Formularios function notEmpty(titulo, elem, helperMsg){ if(elem.value.length == 0){ Ext.MessageBox.alert(titulo, helperMsg, function() { Ext.get(elem).focus(); }); /* alert(helperMsg); elem.focus(); // set the focus to this input */ return false; } return true; } function isNumeric(titulo, elem, helperMsg){ var numericExpression = /^[0-9]+$/; if(elem.value.match(numericExpression)){ return true; }else{ Ext.MessageBox.alert(titulo, helperMsg, function() { Ext.get(elem).focus(); }); return false; } } function isAlphabet(titulo, elem, helperMsg){ var alphaExp = /^[a-zA-Z]+$/; if(elem.value.match(alphaExp)){ return true; }else{ Ext.MessageBox.alert(titulo, helperMsg, function() { Ext.get(elem).focus(); }); return false; } } function isAlphanumeric(titulo, elem, helperMsg){ var alphaExp = /^[0-9a-zA-Z]+$/; if(elem.value.match(alphaExp)){ return true; }else{ Ext.MessageBox.alert(titulo, helperMsg, function() { Ext.get(elem).focus(); }); return false; } } function lengthRestriction(titulo, elem, min, max, helperMsg){ var uInput = elem.value; if(uInput.length >= min && uInput.length <= max){ return true; }else{ Ext.MessageBox.alert(titulo, helperMsg, function() { Ext.get(elem).focus(); }); return false; } } function lengthRestriction_specific(titulo, elem, cant, helperMsg){ var uInput = elem.value; if(uInput.length == cant){ return true; }else{ Ext.MessageBox.alert(titulo, helperMsg, function() { Ext.get(elem).focus(); }); return false; } } function madeSelection(titulo, elem, helperMsg, stringseleccionado){ if(elem.value == stringseleccionado){ Ext.MessageBox.alert(titulo, helperMsg, function() { Ext.get(elem).focus(); }); return false; }else{ return true; } } function emailValidator(titulo, elem, helperMsg){ var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; if(elem.value.match(emailExp)){ return true; }else{ Ext.MessageBox.alert(titulo, helperMsg, function() { Ext.get(elem).focus(); }); return false; } } function archivos(titulo, elem, helperMsg, tipos) { extArray = new Array(tipos); function LimitAttach(form, file) { allowSubmit = false; if (!file) return; while (file.indexOf("\\") != -1) file = file.slice(file.indexOf("\\") + 1); ext = file.slice(file.indexOf(".")).toLowerCase(); for (var i = 0; i < extArray.length; i++) { if (extArray[i] == ext) { allowSubmit = true; break; } } if (allowSubmit) form.submit(); else Ext.MessageBox.alert(titulo, helperMsg, function() { Ext.get(elem).focus(); }); } } function confirmar_claves(titulo, elem1, elem2, helperMsg) { if (elem1.value == elem2.value) { return true; } else { Ext.MessageBox.alert(titulo, helperMsg, function() { Ext.get(elem2).focus(); }); return false; } } function confirmacion(titulo, helperMsg){ Ext.MessageBox.confirm(titulo, helperMsg, showResult); if (showResult='YES') { return true; } else { return false; } } function closer() { var ventana = window.self; ventana.opener = window.self; ventana.close(); }