Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

159
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!