Re: best way to handle required form fields

From: Date: Wed, 14 May 2003 01:52:36 +0000
Subject: Re: best way to handle required form fields
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147525@lists.php.net to get a copy of this message
Hello, On 05/13/2003 09:20 PM, daniel@electroteque.org wrote:
hi there i was wondering what would be the most ideal way to handle required form fields say if they were empty and are required , should i do a check and send an error and return to the page with the required fields in red or would a javascript alert box (ugly) be ok ? reason being my prefered way would be sending an error although with my previous issue with custom error handlers might be tedious :|
If you redisplay the form marking the invalid fields with HTML, that will work when Javascript is disabled. You may want to check the examples this class for generating and validating forms that do it that way: http://www.phpclasses.org/formsgeneration -- Regards, Manuel Lemos

« previous php.general (#147525) next »