Home » Database » DB_Table » Bug #6036
interface to add further Quickform-Elements
Details
| Request #6036 | interface to add further Quickform-Elements |
|---|---|
| Submitted | 2005-11-22 18:23 UTC |
| From | arne dot bippes at brandao dot de |
| Assigned | wiesemann |
| Status | Closed |
| Package | DB_Table |
| PHP Version | Irrelevant |
| OS | irrelevant |
| 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!