vin23akleh
Programmer
hello
i am trying to do a validation form but i ended up with one that only works for chrome, not on IE not on Firefox! don't know why!!! and another problem it looks like that the return false doesn't even work, it proceeds to the next page anyway
i am trying to do a validation form but i ended up with one that only works for chrome, not on IE not on Firefox! don't know why!!! and another problem it looks like that the return false doesn't even work, it proceeds to the next page anyway
HTML:
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="-1")
{
alert(alerttxt);
return false;
}
else
{
return true;
}
}
}
/*function alertt(thisform)
{alert(thisform);}*/
function validate_form(thisform)
{
//alert('hi');
with (thisform)
{
if (validate_required(i_am_a,"i_am_a must be filled out!")=="-1")
{i_am_a.focus();
return false;}
}
HTML:
<form method="post" action="index.php?page=step2" onsubmit="return validate_form(i_am_a.options[i_am_a.selectedIndex].value);">
<table class="text">
<tr>
<td class="text">???</td>
<td>
<select name="i_am_a" id="i_am_a"> <!--onchange="validate_form(i_am_a.options[i_am_a.selectedIndex].value);">-->
<option selected value="-1">?????? ???????</option>
<option value="MSW">??? ???? ?? ?????</option>
<option value="WSM">????? ???? ?? ???</option>
</select>
</td>
</tr><tr class="submit">
<td>
</td>
<td>
<input type="submit" value="????? ???? ?????" />
</td>
</tr>
</table>
</form>