Re: DB_Table Quckform Element Rules - Can't get error validation to work
| From: | Mark Wiesemann | Date: | Fri, 18 Nov 2005 09:05:30 +0000 |
| Subject: | Re: DB_Table Quckform Element Rules - Can't get error validation to work | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21980@lists.php.net to get a copy of this message | ||
"Jay Callicott" wrote:
> I'm trying to enforce element rules for my DB_Table quickform. I
> imagine this is obvious for HTML_Quickform users but I only use the
> quickform option within DB_Table. Anyways I set the qf rules for the
> table like so:
>
> 'qf_rules' => array( 'required' => 'This field is
> required.' )
Seems to be correct, although I can't see the code around it.
> If I don't fill in the values of the form nothing happens. It doesn't
> generate an error message.
Do you call $form->validate() in your script? Otherwise, the server side
validation won't happen.
> I don't know if it's supposed to generate a client-side message or
> what.
Client-side validation code is not generated by default in DB_Table
(because of historical / BC reasons).
You can activate it by setting the fourth parameter in the getForm()
call to true. Or, if you want it only on a per-column base, set
'qf_client' to true in the column definition.
If this doesn't help you, please provide more of your code. You can mail
me directly, if you want.
Regards,
Mark