mapes911 wrote:
> 
> HI,
> 
> Question about not reusing a variable name. You're talking about the name
> you give the actual dijit element right? Like for example.
> 
>       $this->addElement('ValidationTextBox', 'name', array(
>             'validators' => array(
>                 array('StringLength', false, array(0, 255)),
>             ),
>             'label'          => 'Name:',
>             'required'       => true,
>             'invalidMessage' => 'ERROR MESSAGE HERE',
>             'trim'      => true,
>         ));
> 

Actually, in this case I'm creating the elements in the view script. I have
several line items to loop through, so I'm creating a form for each. I guess
I could create that in the controller file, but I'm not sure how, and this
works too. When I'm talking about adding microtime, I'm talking about when
there are multiple (identical) forms on the same page and you create the
elements like the following:

<td><?=$this->validationTextBox("lineItemQuantity-".$item["lineItemID"].microtime(true),
$item["lineItemQuantity"], array( "required"=>"true",
'regExp'=>'[\d]+','style'=>'width: 50px'))?></td>

That may seem to be obvious in hindsight, but I hadn't realized at the time
that this style of dijit creation used the "name" attribute for the "id"
attribute too. Since you can't have more than one element with the same id
in an XHTML doc, this workaround is needed. I scrape off the microtime in
the action the data is posted to. In my xhr action, I set the following when
I return the new list of line items:

        $this->_helper->layout->disableLayout();
        Zend_Dojo::enableView($this->view);
        Zend_Dojo_View_Helper_Dojo::setUseDeclarative();
        $this->render('editLineItemsPartial');

HTH,
--Mark G.


-----
Mark Garrett
DailyDNA
Arkadelphia, AR
(Telecommuting to: Rogue River, OR)
-- 
View this message in context: 
http://www.nabble.com/Dijit-elements-and-xhrPost-tp20276334p22331420.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to