Hi everyone.
I have this web page:
[php]
<html>
<head>
<SCRIPT>
<!--
function validate(thefor m)
{
for (var a = 0; a < theform.element s.length; a++)
{
var campo = theform.element s[a];
if (campo.value.le ngth <= 0)
{
window.alert('K O');
campo.focus();
return false;
}
}
return(true);
}
// -->
</script>
</head>
<body>
<form action="paginat .asp" method="POST" onSubmit="retur n validate(this)" >
<select size="1" name="D1">
<option>Selec t</option>
<option value="CCC">CCC </option>
<option value="AAA">AAA </option>
<option value="BBB">BBB </option>
</select>
<select size="1" name="D2">
<option>Selec t</option>
<option value="CCC">CCC </option>
<option value="AAA">AAA </option>
<option value="BBB">BBB </option>
</select>
<input type="submit" value="Invia" name="B1">
</form>
</body>
</html>
[/php]
I check that the value of select D2 is always different from value select D1.
For example:
1) value of select D1 = AAA
2) value of select D2 = BBB
it's right.
1) value of select D1 = AAA
2) value of select D2 = AAA
it's wrong.
Can you help me for to have this control in the function validate(thefor m) ?
many thanks
Viki
I have this web page:
[php]
<html>
<head>
<SCRIPT>
<!--
function validate(thefor m)
{
for (var a = 0; a < theform.element s.length; a++)
{
var campo = theform.element s[a];
if (campo.value.le ngth <= 0)
{
window.alert('K O');
campo.focus();
return false;
}
}
return(true);
}
// -->
</script>
</head>
<body>
<form action="paginat .asp" method="POST" onSubmit="retur n validate(this)" >
<select size="1" name="D1">
<option>Selec t</option>
<option value="CCC">CCC </option>
<option value="AAA">AAA </option>
<option value="BBB">BBB </option>
</select>
<select size="1" name="D2">
<option>Selec t</option>
<option value="CCC">CCC </option>
<option value="AAA">AAA </option>
<option value="BBB">BBB </option>
</select>
<input type="submit" value="Invia" name="B1">
</form>
</body>
</html>
[/php]
I check that the value of select D2 is always different from value select D1.
For example:
1) value of select D1 = AAA
2) value of select D2 = BBB
it's right.
1) value of select D1 = AAA
2) value of select D2 = AAA
it's wrong.
Can you help me for to have this control in the function validate(thefor m) ?
many thanks
Viki
Comment