Re: Re: seeking data validation class
| From: | Peter J. Schoenster | Date: | Sat, 28 Sep 2002 03:56:20 +0000 |
| Subject: | Re: Re: seeking data validation class | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117915@lists.php.net to get a copy of this message | ||
On 27 Sep 2002 at 22:09, Manuel Lemos wrote:
> Assumming that you tried the forms generation and validation class, what
> did you realize that was missing to match your needs?
>
> http://www.phpclasses.org/formsgeneration
Well that's the first thing I found and I downloaded it. It does much
more than what I want, for instance here:
> $subscription->AddInput(array(
> "TYPE"=>"text",
> "NAME"=>"email",
> "MAXLENGTH"=>100,
> "Capitalization"=>"lowercase",
> "ValidateAsEmail"=>1,
> "ValidationErrorMessage"=>"It was not specified a valid e-mail
> address"
> ));
Those attributes already exist in the form. I create the forms on the
fly only once afterwhich they are in the hands of the designers to
manipulate. I pass back to the form a data structure that will have
something like:
missing_email
invalid_email
and the designer can check for this, lke this in smarty:
{if $error.missing_email}Yo give me email{/if}
{if $error.invalid_email}Please verify your email{/if}
and I have a script that will generated those if statements so one
doesn't need to do a lot of typing.
I don't like generating the form programmatically all the time ... I
leave that to the *view*.
I just want to pass the input data I received, the definition of the
form I'm using with this data and have the function return the 3 arrays
: good, invalid, missing. I've been very happy with this in Perl.
The formgen is very powerful, too powerful and too intrusive into the
other things I'm doing. I only need a small part of it. What I want has
nothing really to do with html forms, just data validation.
Peter