Andreas: HILFE - Wer kann mir bei der Formularprüfung helfen????

Beitrag lesen

Hallo Andreas !

Also, wie wär's denn damit ?:

function eingabecheck()
{
for (var i = 0; i < document.forms["formeins"].elements.length; i++) {
   x = 0;
   while(x < document.getElementsByName["abc"][x])
   {
       if(document.getElementsByName["abc"][x].value == "")
       {
          alert("Bitte Wert in das Feld eingeben");
          return false;
          break; // UND das ist wichtig (oder auch nicht)
       }
   }
   return true; // kommt nur, wenn noch nicht vorher abgebrochen wurde
   }
if(document.forms["formeins"].elements["abc"].value == "")
{
alert("Bitte Wert in das Feld eingeben");
return true;
}
}
}

und ?

benji

Hallo Benji

in Zeile 52 wird ein Objekt erwartet:
<html>

<head>
<script type="text/javascript" >

function eingabecheck()
{
for (var i = 0; i < document.forms["formeins"].elements.length; i++) {
x = 0;
   while(x < document.getElementsByName["abc"][x])
   {
       if(document.getElementsByName["abc"][x].value == "")
       {
          alert("Bitte Wert in das Feld eingeben");
          return false;
          break; // UND das ist wichtig (oder auch nicht)
       }
   }
   return true; // kommt nur, wenn noch nicht vorher abgebrochen wurde
   }
if(document.forms["formeins"].elements["abc"].value == "")
{
alert("Bitte Wert in das Feld eingeben");
return true;
}
}
}

</SCRIPT>

<body>

<form name="formeins">
<table>
<tr><td>
<input type=text name=abc>
</td></tr>
<tr><td>
<input type=text name=abc>
</td></tr>
<tr><td>
<input type=text name=abc>
</td></tr>
<tr><td>
</table>

<input type=button value="TEST" onClick="eingabecheck()">

</form>

</body>
</html>