Código HTML:
<html>
<head>
<title>Untitled</title>
<script language=JavaScript type=text/javascript>
<!--
String.prototype.itsWhitespace = function(){
return this.search(/S/g) == -1 ? true : false
}
var msk_txt = /CAMPOd/
function check_txt(current_form){
var valores="<?=$cadenaArray?>";
var its_ok = 0
for(var ctr = 0; ctr < current_form.length; ctr++){
if(msk_txt.test(current_form[ctr].name)){
if(current_form[ctr].value.itsWhitespace()){
its_ok++
}else{
}
if (current_form[ctr].name=="CAMPO1" && valores.indexOf(current_form[ctr].value)!=-1){
its_ok++;
}
}
}
if(its_ok == 0){
// Enviamos el formulario
current_form.submit()
}else{
alert("Por favor rellene todos los campos ")
}
}
//-->
</script>
</head>
<body>
<form action="formulario.php" method="post" name="form1" onsubmit="return false">
<input type="text" name="CAMPO1" >
<input type="text" name="CAMPO2" >
<input type="text" name="CAMPO3" ><br>
<input type="button" value="Enviar" onclick = "check_txt(this.form)">
</form>
</body>
</html>