i wanted to validate my form but im stuck with the validation of formfield persnr. It won´t compare the string. For this i already tried the comparison and operators (or || ). The validation of the other fields is ok. Did i use the operators wrong?
function checkForm() {
var strFehler = '';
if (document.forms[0].user.value == "user")
strFehler += "user not ok!\n";
if (document.forms[0].test.value == "")
strFehler += "test not ok!\n";
if (document.forms[0].time.value == "")
strFehler += "time not ok";
if (document.forms[0].cost.value == "")
strFehler += "cost not ok!\n";
if (document.forms[0].persnr.value != "13088") || (document.forms[0].persnr.value != "10286")
strFehler += "persnr false!\n";
if (strFehler.length > 0) {
alert("problems!!: \n\n" + strFehler);
return (false);
}
}
I expected that the validation would show an alert if the value isn´t 13088 or 10286 but no message pops up.