Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

160
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda