Re: simple form validation

From: Date: Mon, 04 Dec 2000 10:00:18 +0000
Subject: Re: simple form validation
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-28549@lists.php.net to get a copy of this message
On Mon, 4 Dec 2000 15:38:03 -0600, Jacky (jacky@activelifestyle.com) wrote: >Hi all, >I know this is perhaps very simple thing but would be pleased if >anyone can give me teh straight forward way. I need to validate a >form that not allowed the form to be submitted if there is any field >left blank. I would like to use javascript if that is possible. But >I get confused with how could I embed javascript to validate the >form as I am more familiar with ASP than PhP. >Jack >jacky@activelifestyle.com >"Power is nothing without control something like this: <script language="javascript"> function checkfields() { for(i=0;i<this.form.length;i++){ if(this.form.elements[i].value.length==0){ alert("fill them all out!"); return false; } } return true; } </script> <form name=form onsubmit="return checkfields();"> - Mark

« previous php.general (#28549) next »