Unable to validate a form using Javascript; PHP redirect issues?
I've coded a simple form for a friend's hobby; basically, we are trying to guess the starting lineup for a couple of teams in the 2010 FIFAWorld Cup (just for the kicks).

Anyway, I need to validate the following form. All the Javascript functions appear to function well because if i just call them **outside** of the <form> tag, everything works fine. Now, i want to perform some basic client-side validation (i know, it isn't safe blabla but it's a hobby, so it isn't relevant) and then pass the form to another page where a PHP (currently using WAMP Server 2.0) script will collect the data and store it in the database.

Here's the form:

    <form name ="formPT" id="formPT" action="" onsubmit="return ValidaTudo();" method="post">
    <a><img src="icons/paises/portugal-flag-icon.png" alt="portugal" border="0" style="vertical-align:middle"> Portugal</a>
    <table id="tabela_PT" cellspacing="0" summary="Equipa">
    <thead>
    <tr>
    <th scope="col" abbr="Nome" class="nobg">Nome</th>
    <th scope="col" abbr="Posicao">Posição</th>
    <th scope="col" abbr="Escolha">Escolha</th>
    <th scope="col" abbr="Anterior">Escolha Anterior</th>
    </tr>
    </thead>
    <tbody>
    <tr><td scope="row" abbr="Jogador" class="spec">Eduardo</td><td>Guarda-redes</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Beto</td><td>Guarda-redes</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Daniel Fernandes</td><td>Guarda-redes</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Paulo Ferreira</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Miguel</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Ricardo Carvalho</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Bruno Alves</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Ricardo Costa</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Fabio Coentrao</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Pepe</td><td>Médio</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    </tbody>
    </table>		
    <input type='submit' value='Check Field' />
    </form>

Now for a bit of Javascript:

     function ValidaTudo()
    {
    	alert('debug: validating...')
    	if(Valida('PT'))
    	{
    		alert('fine!');
    		return true;
    	}
    	else
    	{
    		alert('useless validation message but wth');
    		return false;
    	}
    }

There's more javascript functions, obviously, but:

 - I'm not getting *any* alert popup from that javascript function!
 - The page is, quite simply, redirected to index.php so i'm assuming it's a PHP/WAMP issue... i rebooted WAMP quite a couple of times, but no luck so far. I haven't reboot my PC although I think I should.

What am i missing? Thanks in advance guys!

PS: Yes, the form isn't sending the data to any page at all; i know that; it does not have any effect on the weird behavior, i've tried it.
Unable to validate a form using Javascript; PHP redirect issues?
===

I've coded a simple form for a friend's hobby; basically, we are trying to guess the starting lineup for a couple of teams in the 2010 FIFAWorld Cup (just for the kicks).

Anyway, I need to validate the following form. All the Javascript functions appear to function well because if i just call them **outside** of the <form> tag, everything works fine. Now, i want to perform some basic client-side validation (i know, it isn't safe blabla but it's a hobby, so it isn't relevant) and then pass the form to another page where a PHP (currently using WAMP Server 2.0) script will collect the data and store it in the database.

Here's the form:

    <form name ="formPT" id="formPT" action="" onsubmit="return ValidaTudo();" method="post">
    <a><img src="icons/paises/portugal-flag-icon.png" alt="portugal" border="0" style="vertical-align:middle"> Portugal</a>
    <table id="tabela_PT" cellspacing="0" summary="Equipa">
    <thead>
    <tr>
    <th scope="col" abbr="Nome" class="nobg">Nome</th>
    <th scope="col" abbr="Posicao">Posição</th>
    <th scope="col" abbr="Escolha">Escolha</th>
    <th scope="col" abbr="Anterior">Escolha Anterior</th>
    </tr>
    </thead>
    <tbody>
    <tr><td scope="row" abbr="Jogador" class="spec">Eduardo</td><td>Guarda-redes</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Beto</td><td>Guarda-redes</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Daniel Fernandes</td><td>Guarda-redes</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Paulo Ferreira</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Miguel</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Ricardo Carvalho</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Bruno Alves</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Ricardo Costa</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Fabio Coentrao</td><td>Defesa</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    <tr><td scope="row" abbr="Jogador" class="spec">Pepe</td><td>Médio</td><td><select  name="escolhaPT"><option value="EF">EF</option><option value="SP">SP</option><option value="NU" selected="selected">NU</option></select> </td><td>NU</td></tr>
    </tbody>
    </table>		
    <input type='submit' value='Check Field' />
    </form>

Now for a bit of Javascript:

     function ValidaTudo()
    {
    	alert('debug: validating...')
    	if(Valida('PT'))
    	{
    		alert('fine!');
    		return true;
    	}
    	else
    	{
    		alert('useless validation message but wth');
    		return false;
    	}
    }

There's more javascript functions, obviously, but:

 - I'm not getting *any* alert popup from that javascript function!
 - The page is, quite simply, redirected to index.php so i'm assuming it's a PHP/WAMP issue... i rebooted WAMP quite a couple of times, but no luck so far. I haven't reboot my PC although I think I should.

What am i missing? Thanks in advance guys!

PS: Yes, the form isn't sending the data to any page at all; i know that; it does not have any effect on the weird behavior, i've tried it.