Re: QuickFormController Privates? - Re: [PEAR-BUG] #60 [Asn]: varname error (and limitation)
| From: | Bertrand Mansion | Date: | Sun, 05 Oct 2003 14:48:08 +0000 |
| Subject: | Re: QuickFormController Privates? - Re: [PEAR-BUG] #60 [Asn]: varname error (and limitation) | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-22384@lists.php.net to get a copy of this message | ||
<alan@akbkhome.com> wrote :
> Can someone that knows QF Controller explain this.. ?
HTML_QuickForm_Page has a method named getButtonName() that will generate a
value for the submit buttons. The generated value, once submitted, will be
used by the controller to know which page is requested (next, previous,
etc.). Those special button values start with _qf_ in order to let the
controller know they are special values (not to be included in the values of
the form returned by exportValues()).
http://pear.php.net/manual/en/package.html.html-quickform-controller.html-qu
ickform-page.getbuttonname.php
So I guess the problem is the first underscore, and we have 2 solutions:
1. We change this in HTML_QuickForm_Controller which probably wouldn't be a
problem as they are generated in a private way.
2. You change the parser in Flexy (which I guess is going to be more of a
problem).
My opinion is 1 is better, but Alexey will take the final decision as he is
lead on the QuickForm Controller.
Bertrand
>>> and I've not come up with any good reason _yet_ for changing it.. :)
>>
>>
>> One reason might be so you can use Flexy as a renderer for
>> QuickFormController (without hacking around) .. :)
>>
>> It makes buttons that start with '_qf_'.
>>
>>
>>
>> The problem is that starting with a underscore does not always mean
>> 'private', but is also used for namespace reasons ...
>>
>>
>>
>> Greetings,
>>
>> Jeroen.
>>
>>
>> Previous Comments:
>> ------------------------------------------------------------------------
>>
>> [2003-10-04 09:57:01] alan_k@php.net
>>
>> Documentation issue
>>
>>
>>
>> Yes it is by design.. - Private variables/methods should not be
>> accessable..
>>
>>
>>
>> It made sense at when I designed the parser to do this.. and I've not
>> come up with any good reason _yet_ for changing it.. :)
>>
>>
>>
>> Regards
>>
>> Alan
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> [2003-10-04 09:42:46] jeroen at zwolnet dot com
>>
>> Description:
>> ------------
>> See code and workaround (explains it all :)
>>
>>
>>
>> 1. (this might be by design): it looks like vars are not allowed to
>> start with a underscore. So eg. 'p._child' in exampple is not allowed.
>>
>>
>>
>> 2. (more serious): using a var in the parameterlist seems to loose the
>> last character. In the workaround adding a 'x' after the var name 'p1'
>> generates the correct code.
>>
>> Reproduce code:
>> ---------------
>> Template source:
>>
>>
>>
>> DOES NOT WORK:
>>
>> {foreach:p._child,n1,p1}
>>
>> ...
>>
>> <a href="{t.url(p1)}">{p1.title}</a>
>>
>>
>>
>> WORKAROUND:
>>
>> {foreach:p.treeChild,n1,p1}
>>
>> ...
>>
>> <a href="{t.url(p1x)}">{p1.title}</a>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>