Re: Re: DB_Table QuickForm rules

From: Date: Thu, 20 Apr 2006 13:12:54 +0000
Subject: Re: Re: DB_Table QuickForm rules
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-23768@lists.php.net to get a copy of this message
On 20 Apr 2006, at 14:39, Mark Wiesemann wrote:
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().
Not working with the renderer I use.
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.
I did the last one: <<< $element =& $oBet->getFormElement('title', 'vbet'); $G_FORM->addElement($element); DB_Table_QuickForm::addRules($G_FORM, array($oBet->col['title']));
But unfortunately still no errors. Even if I add the fourth parameter to it (clientside validation) it will not present me with an alert/confirm message. What I'm doing wrong?
(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.
Thanx for these notes. Always good to have. I saw in the comments in the script. It means if I don't define anything then these default issues will work? Because these are fine! ;) - Charlie

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