Re: Validation class comments
| From: | Ondrej Jombik | Date: | Wed, 29 May 2002 16:04:11 +0000 |
| Subject: | Re: Validation class comments | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6622@lists.php.net to get a copy of this message | ||
Maxim, 18:01:39
29. maj 2002 (streda)
Greetings.
> $opts = array(
> 'name' => array('string', VAL_NAME, 1, 50),
> 'address => array('string', VAL_STREET, 1, 100),
> 'age' => array('number', false, 1, 120)
> );
> $res = Validate::multiple($_POST, $opts, true)
> The $strict arg will remove all the values from the $data param that
> aren't in the $val_type array. Still in the TOTHINK is how to return a
> clear answer of what and where the validation failed.
My 3 possibilities:
1. Put markers into $opts array (it needs to be passed as reference). So if
name is valid, than $opts['name']['valid'] = true;
2. Returns associative array with validation status values ('name' => true,
'address' => false, ...).
3. Simply returns array of valid members (idexes or names).
I'm for the first possibility. You have once $opts created, it will
be nice to see results there. Note that than in this case WON'T be possible
direct array passing. $res = Validate::multiple($_POST, array(...), true);
=Nepto=
____________________________________________________________________________
Ondrej 'Nepto' Jombik, http://www.nepto.sk/
nepto@atomicpile.sk