2012-10-01 52 views
1

我正試圖將鏈接插入到窗體上顯示的錯誤消息。在我的行動中,我已經做到了。是什麼導致html標記在Zend_Element錯誤裝飾器中不呈現?

$this->view->editForm->getElement('value')->addError('this type/value combination already exists. click <a href="' 
     . $this->view->url(array(
      'module' => 'collection', 
      'controller' => 'tag', 
      'action' => 'detail', 
      'id' => $tagExists->getId() 
     ), null, true) 
    .'">here</a> to load the existing tag'); 

所以我想在我的網頁瀏覽器看的時候呈現的是

this type/value combination already exists click here to load the existing tag 

和我所看到的是

this type/value combination already exists click <a href="/collection/tag/detail/id/9">here</a> to load the existing tag 

我不知道如何真正原因該鏈接在瀏覽器中正確呈現。我假設在那個錯誤裝飾器中有某種​​輸出衛生髮生,但我不知道我應該在哪裏看。

回答

2

您需要將錯誤裝飾器上的escape選項設置爲false

$this->view->editForm->getElement('value') 
    ->getDecorator('Errors')->setOption('escape', false); 
+0

確定,這將引發一個錯誤setEscape()不似乎對錯誤裝飾 – kristopher

+0

調用未定義的方法Zend_Form_Decorator_Errors的方法: :setEscape() – kristopher

+0

@kristopher對,我在看* *描述*裝飾。我已經更新了我的答案 – Phil

0

我試圖

$this->view->editForm->getElement('value') 
    ->getDecorator('Errors') 
    ->setOptions(array('escape' => false)); 

其中工程