Re: QFC / HTML_Sigma_Template / ITStatic
| From: | Alexey Borzov | Date: | Tue, 21 Oct 2003 20:12:30 +0000 |
| Subject: | Re: QFC / HTML_Sigma_Template / ITStatic | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8520@lists.php.net to get a copy of this message | ||
Hi!
Daniel Kopp wrote:
I would like to use the Template Engine described under QF - HTML_QuickForm_Renderer_ITStatic Now I also want to use QFC and not just QF, so I would need to add Buttons with: $this->addElement('submit',$this->getButtonName('whatever'),'TEST'); Do I definitely need the "$this->getButtonName('whatever')" or is there another way? Because like that I don't know what to write in my Template. To put GetActionName in the AddAction - call also does not work - I get an Error-Message "Illegal offset type" Or should I look for a way to show the Buttons in the Template Engine? So far I think I need the name - plain and just as I set it ...Well, this issue was raised before with FlexyStatic renderer, so I think this requires a long answer and (later) a mention in the manual. I think you basically have three options with ITStatic 1) Add the buttons/placeholders with the names that should be autogenerated to the form. 2) Put the auto-named buttons into group 3) Use template callbacks Option 1 is a hack, as the names should not be of interest to anyone except Controller itself and should not be used directly. Thus it is *not* recommended. Option 2 relies on the fact that when ITStatic sees the {form_element_html} placeholder, it'll assign group's HTML to it. And you can name the group any way you like, just be sure to set $appendName to false. In option 3 you add the buttons to the template like this: <input type="submit" value="Bla-bla" name="func_buttonName('whatever')" ... /> and in _renderForm() method of your Display handler do $tpl->setCallbackFunction('buttonName', array(&$page, 'getButtonName')); You'll need either HTML_Template_Sigma or HTML_Template_ITX (note the X) for this to work, the code presented will work with the former, the latter will require some more tweaking.