fafnirbcrow
fafnirbcrow

Reputation: 270

populating a zend form helper with data

I have a custom view helper that I am using to add elements to a form. I am trying to get it to properly populate data that has been saved to the database.

The problem is that that data is not getting passed into the view helper

class View_Helper_JQMy extends ZendX_JQuery_View_Helper_UiWidget
{

    public function jqMy($id, $value=null, $attribs=null, $options=null)
    {}

When I am building the form in the form controller and setting all the options there, they get properly passed in and the form builds.

However when I call $form->populate($data) from the controller, this form element does not get data

My best guess is that the jqMy helper is being called before $value is being set with the data I want to populate in the form. But I can't identify how this differs from the core zend form elements populating.

Upvotes: 1

Views: 403

Answers (1)

Pablo Morales
Pablo Morales

Reputation: 717

You can access to the view Object into the view helper using the propertie $this->view from the helpers. The abstract Zend_View_Helper_Abstract have the property view. You maybe use something like $this->view->form->getValues() or something like that

Upvotes: 1

Related Questions