Re: QF tabbing order

From: Date: Mon, 06 Oct 2003 20:16:52 +0000
Subject: Re: QF tabbing order
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8308@lists.php.net to get a copy of this message
Jeroen Houben wrote in php.pear.dev: > yeah I know. I would have liked to see a renderer that gives the > template designer more control. I personally think the form labels, > stuff like sizes, style definitions (like class= and id=, or even > style="") should all be dealt with in the template They're the > designer's responsibility IMHO. > I guess it's not hard to get the attribute string created by > quickform and assign it to template vars. The designer could then so > something like: > > <{$form.firstname.QF_attributes} tabindex="0" class="myclass" > />{$form.firstname.error} you can currently do: <input name={$form.firstname.name} type={$form.firstname.type} value={$form.firstname.value} tabindex="0" class="myclass"/>{$form.firstname.error} and maybe (with some adjustments on the ArraySmarty Renderer) there is also a solution for other element types as currently used for the open form tag: <form {$form.attributes}> But I don't like this.. To give the template designer more control he must have an simplier way to control the form definition. For Smarty it would possible to write a combination of plugin functions and QF render to put the form definition directly inside the template: {quickform name=qf} <table> <tr> <td> Firstname {qf_required name="firstname"} </td> <td> {qf_text name="firstname" default=$user.firstname tabindex="0"} {qf_error name="firstname" rule="required"} Please input your firstname. {/qf_error} {qf_error name=firstname rule="lettersonly"} Please input... {/qf_error} </td> </tr> <tr> <td colspan="2"> {qf_submit name="send" label="Send Form" onClick="js_function()"} </td> </tr> </table> {/quickform} <?php require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/Renderer/PluginSmarty.php'; require_once 'Smarty.class.php'; $form = new HTML_QuickForm('form', 'POST'); $tpl =& new Smarty; $renderer =& new HTML_QuickForm_Renderer_PluginSmarty($tpl); // Template to use $renderer->useTemplate('form.tpl); // Extract designers form definition from template $form->prepare($renderer); // Programmers additional form definitions $form->addElement('hidden', 'session', '1234567890'); ... // Render and display the form $form->accept($renderer); $renderer->display(); ?> But this is an complete different way and not so simple to implement as the (Smarty)Array Renderers are.. ;-) ThS. -- http://4bconsult.de

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