Good work around, but shouldn't Zend_Form do this?

Matthew Weier O'Phinney-3 wrote:
> 
> -- Guillaume Oriol <gor...@technema.fr> wrote
> (on Thursday, 04 December 2008, 11:40 PM -0800):
>> Thank you Matthew for your answer
>> but I don't use Zend_Dojo_Form in my form, neither any Dijit.
>> My form extends Zend_Form.
>> 
>> Why would ZF enable Dojo in such a case?
> 
> I know what's going on.
> 
> There is a standard view helper, Form, and one of the same name in the
> Zend_Dojo_View_Helper tree. Because your view object has been
> initialized with the Dojo view helper path, it's finding the Dojo Form
> view helper and using that over the standard one.
> 
> The easiest way around this is to, in your form's render method, remove
> the Dojo view helper path:
> 
>     public function render(Zend_View_Interface $view = null)
>     {
>         if (null === $view) {
>             $view = $this->getView();
>         }
>         $loader = $view->getPluginLoader('helper');
>         if ($loader->getPaths('Zend_Dojo_View_Helper')) {
>             $loader->removePrefixPath('Zend_Dojo_View_Helper');
>         }
>         return parent::render($view);
>     }
> 
> 
>> Matthew Weier O'Phinney-3 wrote:
>> > 
>> > -- Guillaume Oriol <gor...@technema.fr> wrote
>> > (on Thursday, 04 December 2008, 01:38 AM -0800):
>> >> Hi, I am facing a problem with Dojo: I set up Dojo to be disabled by
>> >> default
>> >> but it is still enabled in my login form.
>> >> 
>> >> 
>> >>  1. I've put in my bootstrap file those two lines (set up Dojo
>> >> environment but
>> >>     disable it by default):
>> > <snip> 
>> >>  2. Then, in my authentication controller:
>> > <snip>
>> >>  3. My form extends Zend_Form (NOT Zend_Dojo_Form). Furthermore, I
>> only
>> >> use
>> >>     plain elements that are not Dijits : Zend_Form_Element_Text,
>> >>     Zend_Form_Element_Password et Zend_Form_Element_Submit.
>> >>  4. My view script is very short:
>> > <snip>
>> >>  5. And this view script is invoked by the layout where one can find:
>> > <snip> 
>> >> 
>> >> But, in the generated HTML page, I find in the HEAD tag:
>> > <snip - finds dojo artifacts>
>> > 
>> > So, Zend_Dojo_Form utilizes the Dojo form view helper.. so rendering
>> > your form renders that helper. All Dijit view helpers, on
>> instantiation,
>> > enable the dojo() view helper. So, my recommendations are to either:
>> > 
>> >   * not use Zend_Dojo_Form if you're not actually using any
>> >     dojo-specific elements
>> >   * Call $this->dojo()->disable(); after you render the form
>> > 
>> > -- 
>> > Matthew Weier O'Phinney
>> > Software Architect       | matt...@zend.com
>> > Zend Framework           | http://framework.zend.com/
>> > 
>> > 
>> 
>> 
>> -----
>> Guillaume ORIOL
>> Sofware architect
>> Technema
>> -- 
>> View this message in context:
>> http://www.nabble.com/unable-to-disable-Dojo-tp20830062p20849091.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>> 
> 
> -- 
> Matthew Weier O'Phinney
> Software Architect       | matt...@zend.com
> Zend Framework           | http://framework.zend.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/unable-to-disable-Dojo-tp20830062p25779535.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to