Pergunta

I have edit form for entity. There is element

          $feedback = new FeedbackViewer('Feedback');
    $feedback->setLabel('Feedback')->setRequired(false);
    $feedback->setPostId($this->testimonialId);
    $feedback->setAppId($this->config->testimonials->appId);
    $feedback->setIgnore(true);
    $this->addElement($feedback);

This feedback viewer loads iframe with another zf datagrid that shows feedbacks inside the form. I use this form in ZF datagrid

$entityId = $this->getRequest()->getParam('edit');
        if ($entityId) {
            $entityForm = call_user_func($formCallback, $entityId);
            $form->setUsePreDefinedFormElements(true);
            $form->setForm($entityForm);
        }

But ZF datagrid after saving action triggers error Validation failed. Removing the feedbacks element makes it saving correctly. any suggestions?

Foi útil?

Solução

 $grid->setForm($form);
                if($action != 'show') {
                $form->getForm()->getElement('form_reset')->setLabel(null);
                $form->getForm()->getElement('form_submit')->setLabel(null);

                $gridParam = $this->getRequest()->getParam('grid');
                $startParam = $this->getRequest()->getParam('start');


                if ($gridParam) {
                        if ($gridParam == 'all') {
                                $gridParam = 'index';
                        }

                        // Attach to event listener custom redirect action
                        $grid->listenEvent('crud.after_update', array($this, 'setGridRedirectCallback'), array('action' => $gridParam, 'page' => $startParam));
                        $grid->listenEvent('crud.after_delete', array($this, 'setGridRedirectCallback'), array('action' => $gridParam));
                        $form->getForm()->getElement('form_reset')->setAttribs(array('onclick' => 'window.location.href = "/admin/' . $gridParam . (($startParam) ? '/start/' . $startParam : '') . '";'));
                }

I solved this issue with putting this in If tags, couldn't find better solution.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top