Re: Quickform Renderer
| From: | Bertrand Mansion | Date: | Fri, 04 Apr 2003 16:39:41 +0000 |
| Subject: | Re: Quickform Renderer | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-14895@lists.php.net to get a copy of this message | ||
<jeroen@terena.nl> wrote :
> Bertrand Mansion wrote:
>
>>
>> The rendered array is not meant to replace what you would do with QuickForm.
>> If you need to modify your elements, do it with the QuickForm object. Then,
>> when you are ready, and need an array representation, use toArray().
>>
>> I am not sure I understand what you're talking about.
>>
>>
> I guess I was hoping that with the new Renderer you could chose to do
> all your layout things (like sizes for textboxes, background-colors for
> textareas etc etc) in a template. Quickform's strength (to me) is in the
> filters, rules, setting defaults, how it works with DataObjects etc
> (it's probably my favorite PEAR package, don't get me wrong), but not
> the layout features. I would like to delegate the design of my form to a
> designer who shouldn't have to use PHP, but just edit templates with a
> WYSIWIG editor. Will that be at all possible? If not I think it can be
> done and I'd like to give it a go myself.
That's clearer but I still think it is not needed. With my ITX renderer,
your designer can design his form in a standard way using dreamweaver or
whatever. Instead of actually adding form elements in his design he just
marks them with placeholders, one for the element label and one for the
element html.
Placeholders are just something like this:
<form>
<table>
<tr><td>{qf_label_name}</td><td>{qf_html_name}</td></tr>
</table>
</form>
where {qf_label_name} and {qf_html_name} are the placeholders for the name
element.
Then you ask him (or you do it yourself, or you use QuickForm defaults) to
define standard styles for your elements label and html. For example:
<!-- BEGIN qf_element -->
<!-- BEGIN qf_element_label -->
<font color="blue"><b>{qf_label}</b></font>
<!-- END qf_element_label -->
<!-- BEGIN qf_element_html -->
<div class="input">{qf_html}</div>
<!-- END qf_element_html -->
<!-- END qf_element -->
You do the same for your grouped elements if you have any in your form. If
you have required elements, you can add a qf_element_required block to your
qf_element_label block or wherever you want to see it in the qf_element
block.
And that's pretty much it.
You can have different styles of qf_element blocks with different rendering
and then assign a block to an element. With that and the help of css, there
are no limits in the way you present your form.
I'll post a few examples on my website this weekend to show you how it
works.
> To get back to the selectbox example, I'd a renderer to return a
> selectbox like this:
>
> array(1) {
> ["elements"]=>
> array(1) {
> [0]=>
> array(3) {
> ["name"]=>
> string(4) "city"
> ["type"]=>
> string(6) "select"
> ["values"]=>
> array(3) {
> [0]=>
> array(3) {
> ["value"]=>
> string(3) "ams"
> ["label"]=>
> string(9) "Amsterdam"
> ["selected"]=>
> bool(false)
> }
> [1]=>
> array(3) {
> ["value"]=>
> string(3) "par"
> ["label"]=>
> string(5) "Paris"
> ["selected"]=>
> bool(true)
> }
> [2]=>
> array(3) {
> ["value"]=>
> string(3) "lon"
> ["label"]=>
> string(6) "London"
> ["selected"]=>
> bool(false)
> }
> }
> }
> }
> }
>
> That way you can do anything you want with it. Hope I've made myself
> clearer now, let me know.
There's nothing you would want to do with it that QuickForm couldn't do for
you ;)
Bertrand Mansion
Mamasam