Hi!

I have a form where I need to add dojo events to the elements.

I accomplished the following so far:

class Example_Form extends LFM_Form
{
   public function init()
  {
      Zend_Dojo::enableForm($this);

     ........
     $this->addElement('Button',    'foo',  array('label' => '+'));
                    $this->getView()->dojo()->addOnLoad(
          "function(){
              dojo.connect(dijit.byId('foo'), 'onclick', function(e) {
                  foo(e,'bar')
                 })
           }");
     ........
  }
}

This basically adds programmatically an dojo.addOnload function to the 'foo' element. This is working, but as far as this functionality belongs to the created button object it isn't a very "hadsome" solution.

Is there a more elegant way to solve this?
I'm thinking about something like to be able to pass these params somehow to the 'addElement' function.

Thx,
Lajos

Reply via email to