이 조금 까다로운하지만, 불가능이 아니다 :
당신은 당신의 자신의보기 도우미를 구현하고 요소를 사용해야합니다.
$submit = $form->createElement('submit', 'submitElementName');
$submit->setAttrib('value', 'my value');
$submit->helper = 'customSubmit';
$form->addELement($submit);
:
class View_Helper_CustomSubmit extends Zend_View_Helper_FormSubmit
{
public function customSubmit($name, $value = null, $attribs = null)
{
if(array_key_exists('value', $attribs)) {
$value = $attribs['value'];
unset($attribs['value']);
}
$info = $this->_getInfo($name, $value, $attribs);
extract($info); // name, value, attribs, options, listsep, disable, id
// check if disabled
$disabled = '';
if ($disable) {
$disabled = ' disabled="disabled"';
}
if ($id) {
$id = ' id="' . $this->view->escape($id) . '"';
}
// XHTML or HTML end tag?
$endTag = ' />';
if (($this->view instanceof Zend_View_Abstract) && !$this->view->doctype()->isXhtml()) {
$endTag= '>';
}
// Render the button.
$xhtml = '<input type="submit"'
. ' name="' . $this->view->escape($name) . '"'
. $id
. ' value="' . $this->view->escape($value) . '"'
. $disabled
. $this->_htmlAttribs($attribs)
. $endTag;
return $xhtml;
}
}
그래서, 당신은 요소에 도우미를 할당 :
How to add a view helper directory (zend framework)
당신의 도우미를 구현 : 처음에는
, 사용자 정의보기 도우미 경로를 추가해야합니다
이렇게하면 제출 된 값을 검색 할 수 있습니다. 형태 :
$form->getValue('submitElementName');
안녕하세요 샘. 당신의 도움을 주셔서 대단히 감사합니다. 나는 너의 충고를 따랐다. 안부 인사 Andreea – andreea115