(on Tuesday, 09 December 2008, 07:10 AM -0800):
> Matthew Weier O'Phinney-3 wrote:
> >
> > Two things.
> >
> > First, did you use Zend_Dojo_Form or extend Zend_Dojo_Form? I'm
> > assuming, based on the fact that you got an input, that you did.
> >
> > Second, did you specify a dijit theme at any point? If not, you need to
> > do two things:
>
> Yes, i am using both, zend dojo form and i specified theme in body tag.
> I am using Zend_Dojo_Form as follow:
> (inside WebMastersController.php)
> ****************************************************************************
> public function viewAction ()
> {
> $form = new Zend_Dojo_Form();
>
> $form->setMethod('post')->setAction("../admin/news/process")->setName('editNews');
Bad action -- use the URL action or view helper to form your URLs.
> $form->setDecorators(array (
> 'FormElements' , array (
> 'ContentPane' , array (
> 'id' => 'newsPane' , 'style' => 'width:100%; ', 'dijitParams' =>
> array (
> 'tabPosition' => 'top'
> )
> )
> ) , 'DijitForm'
> ));
> $input = new Zend_Dojo_Form_SubForm();
> $input->addElement('ComboBox', 'myAutoCompleteField', array (
> 'label' => 'My autocomplete field:' , 'storeId' => 'autocompleter' ,
> // used as a JS variable name by dojo
> 'storeType' => 'dojox.data.QueryReadStore' , // type of dojo.data store;
> this is a
> 'storeParams' => array (
> 'url' => 'admin/webmasters/autocomplete' // specify the
> appropriate URL for
Bad url -- it should begin with a '/'. Rule of thumb: use the URL action
or view helper to form your URLs.
> )// data store handler
>
> ));
> $form = $form->addSubForm($input, 'memberName');
> $this->view->autoComplete = $form;
> }
> *******************************************************************************
> in my view.phtml :
> <ol id="wp">
> <li id="bd">
> <ol id="doc">
> <li id="s1"><?= $this->partial('menu.phtml')?></li>
>
> <li id="s2">
> <?= $this->autoComplete ?>
> </li>
> </ol>
> </li>
> </ol>
> ********************************************************************************
> in my main layout.phtml (all others dojo forms works properly)
> .... </head>
> <body class="tundra">.......
>
> i created indexAction inside WebmasterController.php as follow:
> ******************************************************
> public function indexAction ()
> {
> $model = new AdminWebmasters();
> $params = $this->getRequest()->getQuery();
> $results = $model->query($params);
> $this->view->data = new Zend_Dojo_Data('username', $results,
> 'name');
> }
> ******************************************************
> and my model looks like:
> //AdminWebmasters.php
> class AdminWebmasters extends Zend_Db_Table_Abstract
> {
> /**
> * The default table name
> */
> protected $_name = 'webmasters';
> protected $db;
> public function __construct ()
> {
> $this->db = Zend_Registry::get('db');
> }
> public function getAllWebmasters ($params)
> {
> $select = $this->db->select()->from('webmasters', array (
> '*'
> ));
> return $this->db->fetchAll($select);
> }
> }
>
> At the end, when i load http://mysite.com/admin/webmasters/view
> my form (autocomplete) still looks like ordinary input field. (on other
> pages, with other zend_dojo_form everything works good)
> Also, i see that firebug trowns an error:
> Could not load 'dojo.data.QueryReadStore'; last tried
> './data/QueryReadStore.js'
Again, use "dojox.data.QueryReadStore" -- note the "x" following "dojo".
> I atached a print screen of that.
> http://www.nabble.com/file/p20916423/dojoError.gif dojoError.gif
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论