2010-06-10 4 views
0

사용자가 지정된 정보를 입력 할 수있는 (예 : 메시지 보내기) 모달 창을 만들기 위해 ZendX_JQuery dialogContainer보기 도우미를 사용하려고합니다. 이 방식으로 dialogContainer보기 도우미를 사용하려고합니다.ZendX_JQuery dialogContainer 용도

먼저, 응용 프로그램 라이브러리 폴더에 ZendX 라이브러리를 포함하십시오. 둘째

의 Bootstrap.php 내에서 initViewHelper 방법에 다음 행이

파일 포함 "$보기 ->를 addHelperPath ('ZendX/JQuery와 /보기/도우미 /', 'ZendX_JQuery_View_Helper');"

제 첨가하여 layout.phtml에 JS의 활성화 조건 다음

"<?php if($this->jQuery()->isEnabled()){ 
       $this->jQuery()->setLocalPath($this->baseUrl() 
       .'/js/jquery/js/jquery-1.4.2.min.js')     
       ->setUiLocalPath($this->baseUrl() 
       .'/js/jquery/js/jquery-ui-1.8.custom.min.js')     
       ->addStylesheet($this->baseUrl() 
       .'/js/jquery/css/ui-lightness/jquery-ui-1.8.custom.css'); 
       echo $this->jQuery(); 
     } 
    ?>" 

넷째 ZendX_JQuery_Form

연장 제 Application_Form_JQueryForm를 생성
"<?php 
    class Application_Form_JQueryForm extends ZendX_JQuery_Form 
     { 
     private $form; 

     public function init() 
     { 
     $this->form = $this->setAction(Zend_Controller_Front::getInstance()->getBaseUrl() . '/index/index') 
         ->setMethod('post'); 


    $this->form->setDecorators(array(
     'FormElements', 
     'Form', 
     array ('DialogContainer', array(
      'id' => 'tabContainer', 
      'style' => 'width: 600px;', 
      'title' => 'Send a private message to Kalle', 
      'JQueryParams' => array(
       'tabPosition' => 'top',      
      ), 
     )), 
    )); 

    $topic = new Zend_Form_Element_Text('topic'); 
    $topic->setValue('topic') 
      ->setRequired(true) 
      ->setValidators(array('validators' => array(
       'validator' => 'StringLength', 
       'options' => array(1,15) 
     ))) 
      ->setDecorators(array(
       'ViewHelper', 
       'Description', 
       'Errors', 
       array('HtmlTag', array('tag' => 'dl')))); 

    $textarea = new Zend_Form_Element_Textarea('textarea'); 
    $textarea->setValue('post a comment') 
      ->setAttribs(array(
       'rows' => 4, 
       'cols' => 20 
      )) 
      ->setRequired(true) 
      ->setValidators(array('validators' => array(
       'validator' => 'StringLength', 
       'options' => array(1,15) 
      ))) 
      ->setDecorators(array(
       'ViewHelper', 
       'Description', 
       'Errors', 
       array('HtmlTag', array('tag' => 'dl')))); 

    $submit = new Zend_Form_Element_Submit('submit'); 
    $submit->setLabel('Send your comment') 
      ->setDecorators(array(
       'ViewHelper', 
       'Description', 
       'Errors', 
       array('Description', array('escape' => false, 'tag' => 'span')), 
       array('HtmlTag', array('tag' => 'dl')))) 
      ->setDescription('or <a href="/index/index/send/false">Cancel</a>'); 


    $this->form->addElements(array($topic, $textarea, $submit));  
} 

}는 " 이러한 형태는 컨트롤러에 통해 인스턴스되고 액션 메서드를 호출하고보기에서 호출했습니다.

그래서 내 문제에, 내가 무엇을해도 예를 들어 dialogContainer 또는 다른 매개 변수 (color, css, height 등등)의 너비를 설정하기 위해 JQueryForm의 setDecorator 파트에있는 폼에 대해이 작업을 수행 할 수 없습니다. 뷰에서 호출 된 결과 모달에 어떠한 변화가 올바른 방향으로 어떤 도움을 크게 미리 칼레 요한슨

답변

0

확실히 늦은 대답을

감사를 감상 할 수있다 - 그러나 플레이의 많은 - 그래서 생각 나는 대답 할 것이다. 모달에 대해 설정하려는 매개 변수는 JQueryParams 배열에서 설정해야합니다. 따라서 - 예 :

$this->form->setDecorators(array(
    'FormElements', 
    'Form', 
    array ('DialogContainer', array(
      'id'   => 'tabContainer', 
      'style'  => 'width: 600px;', 
      'title'  => 'Send a private message to Kalle', 
      'JQueryParams' => array(
       'tabPosition' => 'top', 
       'width'  => '600', 
       'height'  => '450' 
     ), 
    )), 
)); 

이러한 매개 변수 옵션은 jQuery UI 사이트에서 찾을 수 있습니다.

lk

+1

'jQueryParams'의'j'는 소문자 여야합니다. – shoaiblatif