Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help for form validation

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
All is here:
<form action=&quot;method=&quot;POST&quot; name=&quot;sample&quot;
onsubmit=&quot;return ValidateDetails()&quot;>

and lines for field's validation( they have to be not empty):

<script language=&quot;JavaScript&quot;>
function ValidateDetails()
{
form = document.sample;
if (form.Imie.value == '')
{ alert(&quot;Please include your Imie in customer details&quot;); form.Imie.focus(); return (false); }

if (form.Nazwisko.value == &quot;&quot;)
{ alert(&quot;Please include your Nazwisko in customer details&quot;); form.Nazwisko.focus(); return (false); }
 
Just a guess as the complete code wasn't there.

Change
form = document.sample;
To
var form = document.forms.form.sample;

Hope it helps,
Rob
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top