Hi everybody,
how to validate input text in the follow:
if option combo = 1,2 e 3, input 1 and input 2 must be filled, if one of this values not selected in combo (to be others), filled input 3.
validate code with error below:
[CODE=javascript]funcion validate () {
...
valor = document.form.s elect.value;
if (value === "1" || value === "2" || value === "3"){
alert("Input 1 must be filled.");
document.form.i nput1.focus();
return false;
} else if (input2 === "") {
alert("Input 2 must be filled.");
document.form.i nput2.focus();
return false;
} else {
alert("Input 3 must be filled.");
document.form.i nput3.focus();
return false;
}
return true;
}
[/CODE]
Thanks!
how to validate input text in the follow:
if option combo = 1,2 e 3, input 1 and input 2 must be filled, if one of this values not selected in combo (to be others), filled input 3.
validate code with error below:
[CODE=javascript]funcion validate () {
...
valor = document.form.s elect.value;
if (value === "1" || value === "2" || value === "3"){
alert("Input 1 must be filled.");
document.form.i nput1.focus();
return false;
} else if (input2 === "") {
alert("Input 2 must be filled.");
document.form.i nput2.focus();
return false;
} else {
alert("Input 3 must be filled.");
document.form.i nput3.focus();
return false;
}
return true;
}
[/CODE]
Thanks!
Comment