PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_Table » Bug #6036

interface to add further Quickform-Elements

Details

Request #6036interface to add further Quickform-Elements
Submitted2005-11-22 18:23 UTC
Fromarne dot bippes at brandao dot de
Assignedwiesemann
StatusClosed
PackageDB_Table
PHP VersionIrrelevant
OSirrelevant
Roadmaps(Not assigned)

Comments

[2005-11-22 18:23 UTC] arne dot bippes at brandao dot de

Description:
------------
Currently QuickForm::getElement() creates unknown Elements with a standard parameter set. There is no possibilty to add custom QuickForm-Elements which needs further parameters.
Therefore an interface to add custom HTML_QuickForm::createElement()-calls is needed.
A solution might be to just define a qf_type (e.g. function) which instances a class and calls a defined function which is returning an $element.

The following easy code does everything i need and is working for me (see test-script)

Test script:
---------------
#### in the case-statement of QuickForm::getElement() ###
case 'static':
....
break;
/** START NEW CODE */
case 'function':
if ( class_exists($col['qf_class']) && is_callable(array($col['qf_class'],'getElement') )) {
$qf_class =& new $col['qf_class'];
$element =& $qf_class->getElement($col,$elemname,$setval);
break;
}
/** END NEW CODE */
default:
....
#### the column definition ####
$col ...:
'email_an' => array(
'type' => 'varchar',
'qf_type' => 'function',
'qf_class' => 'Bdo_advinput',
'qf_advlabel' => '(z.B. empfaenger@t-systems.com)',
'qf_label' => _('E-Mail Adresse des Empfaengers'),
),
### the class where the getElement()-Method is called ###
class Bdo_advinput {
function getElement(&$col, &$elemname, &$setval) {
$element =& HTML_QuickForm::createElement(
'advinput',
$elemname,
$col['qf_label'],
$col['qf_advlabel'],
(isset($setval) ? $setval : '')
);

return $element;

}
}

[2005-11-23 17:23 UTC] arne dot bippes at brandao dot de

Works perfectly.
Thanks!