Re: Re: DB_Table QuickForm rules

From: Date: Thu, 20 Apr 2006 12:39:42 +0000
Subject: Re: Re: DB_Table QuickForm rules
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-23767@lists.php.net to get a copy of this message
Charlie van de Kerkhof wrote: > But I don't want the whole form be the same elements. Some of them I > want to be grouped and there has to be a couple of other hidden input > elements present in the form. So to my knowledge getForm() is not an > option. You could also specify the column name as the first parameter of getForm(). But it should be sufficient to call something like this: DB_Table_QuickForm::addRules($G_FORM, $cols); where $cols is $oBet->col reduced to the one column you want to use here. (If you use true as the fourth param of addRules(), the rule will be also a client-side rule.) Another note on your table definition: > 'title' => array( > 'type' => 'varchar', > 'size' => 255, > 'require' => true, > 'qf_label' => 'Bet:', > 'qf_type' => 'text', > 'qf_attrs' => array('size' => 50), > 'qf_rules' => array( > 'required' => 'This field is required.' > ) You specified both 'require' and 'qf_rules'/'required'. The last one will also be automatically generated if it's not given. The message can be customized via $GLOBALS['_DB_TABLE']['qf_rules']['required']; (see the comment in Table/QuickForm.php, line 24ff.) This might save you some time if you have more than one field that is required. Regards, Mark

« previous php.pear.general (#23767) next »