Javascript form validate

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

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;}
  }
  
<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">&#1571;&#1606;&#1575;</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">&#1575;&#1604;&#1585;&#1580;&#1575;&#1569; &#1575;&#1604;&#1578;&#1581;&#1583;&#1610;&#1583;</option>
				<option value="MSW">&#1585;&#1580;&#1604; &#1610;&#1576;&#1581;&#1579; &#1593;&#1606; &#1573;&#1605;&#1585;&#1571;&#1577;</option>
				<option value="WSM">&#1573;&#1605;&#1585;&#1571;&#1577; &#1578;&#1576;&#1581;&#1579; &#1593;&#1606; &#1585;&#1580;&#1604;</option>
			</select>
		</td>
		</tr><tr class="submit">
			<td>
			</td>
			<td>
			<input type="submit" value="&#1573;&#1606;&#1590;&#1605;&#1605; &#1575;&#1604;&#1570;&#1606; &#1605;&#1580;&#1575;&#1606;&#1575;" />
			</td>
			</tr>
		</table>
	</form>

after

 
function validate_required(field,alerttxt)
{


add

 
alert(field+"\
"+alerttxt);

what is the output from the alert()?

this is what i managed to collect from forums and google

<form method="post" action="index.php?page=step2" onsubmit="validate_form(this); return false;">
    <table class="text">
    <tr>
    <td class="text">Select Form 1</td>
    <td>
        <select name="selectForm1" id="selectForm1">
            <option selected value="-1">Make a choice</option>
            <option value="MSW">Value 2</option>
            <option value="WSM">Value 3</option>
        </select>
    </td>
    </tr>    
    <td class="text">Select Form 2</td>
    <td>
        <select name="selectForm2" id="selectForm2">
            <option selected value="-1">Make a choice</option>
            <option value="MSW">Value 2</option>
            <option value="WSM">Value 3</option>
            <option value="XSM">Value 3</option>
        </select>
    </td>
    </tr>
    <tr class="submit">
        <td></td>
        <td><input type="submit" value="continue" /></td>
    </tr>
    </table>
</form> 
function validate_form(myForm){
    var select = myForm.getElementsByTagName('select'); // returns all the select forms in a type of array
    var numSF = select.length; // number of select forms
    var selectedIndex;
    for (var i = 0; i < numSF ; i += 1){
        selectedIndex = select[i].selectedIndex;
        if (!selectedIndex){ // ! means not
          alert(select[i].name + ' must be filled out or selected! '); 
          select[i].focus();
          return false;
        }
    }
  myForm.submit();
} 

but there is a problem i didn’t mention
i need it to work for any thing in the form such as input type=“text” and textarea and so on, and also not for each and every one should be validated, only the fields that i want them to be validated
such as username, password, DOB, and such but not a field like address,

I’m not sure how good this is

http://www.webcheatsheet.com/javascript/form_validation.php

Might be useful

I also posted a date validation here, but it might need to be changed depending on the date format you require

RLM