Ver Mensaje Individual
  #2 (permalink)  
Antiguo 26/07/2003, 23:05
cmmo
 
Fecha de Ingreso: junio-2003
Mensajes: 38
Antigüedad: 20 años, 10 meses
Puntos: 0
Hola otra vez,

He seguido probando y probando y ya he dado con el tema. Así que muchas gracias, pero ya no teneis que molestaros.

De todas maneras incluyo la solución por si le sirve a alguien:

Código PHP:
   function ValidateForm()
   {
           var 
wrong=false;
            
with (document.InputForm)
            {
             
number elements.length;
             for (
0number -a++)
             {
                if (
elements[a].disabled == false)
                {
                    if (
elements[a].type == 'text')
                    {                    
                        
// (/ /g, '') es una expresion regular para buscar espacios y substituirlos por ''
                        
if    ((elements[a].value.replace(/ /g'') == '')    || (isNaN(elements[a].value)))    
                        {
                           
elements[a].style.backgroundColor "#ffffcc";
                           
wrongtrue;
                        } 
                        else
                            
elements[a].style.backgroundColor "white";
                      }
                  }

                if (
elements[a].disabled == true)
                {
                    if (
elements[a].style.backgroundColor "#ffffcc")
                        
elements[a].style.backgroundColor "white";    
                }
             }
             if (
wrong)
                  
alert("Some mandatory data are missing or wrong. Please, check and fill the coloured fields before starting the simulation");
             else
                 
submit();
        }
    } 
Este script valida campos vacíos, con espacios en blanco y campos numéricos.
Un saludo,
Carlos.