Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

162
Vistas
Validation User input using javascript

I am novice in php, html and javascript. My aim is to check and validate the user input. My code is working only for one input field which is not in loop. In a moment, I want to check multiple input fields from loop the reply of the code is "* Wrong Insert: undefined, position: null".

Would you be so kind and tell me what am I doing wrong ?

javscript block

    function ValidationSubmit()
    {

         var DatabaseIndex = document.getElementById("3").getAttribute("name");

         var CheckInt    = document.getElementById("3");
         var CheckIntVal = CheckInt.value;
         const a=-10;
         if( a < 0 )
         {
            document.getElementById('demo').innerHTML = "* Wrong insert : " + CheckIntVal + ", position: " + DatabaseIndex ;
          return false;
         }

         else
         {
          return true;
         }

php block for calling validation function ValidationSubmit()

echo '<form method="POST" target="_top" action="SaveForm.php?UID='.$UID.'" onsubmit="return ValidationSubmit()">';

php block for user input


$j = 0;
while($j<=10)
        {
        $ID    = strval($j);
        echo "<td><input type='text' id='$ID' name='$ID' value='$value[$j]'  ></td>";

        $j++;
        }

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda