I figured it out.
I had to go through and destroy each dijit element when i reloaded the page
so that it did not exist at the moment that dojo parsed the new html.
something like this did the trick
dijit.byId(widgetId).destroy(true);
thanks guys!
mapes911 wrote:
>
> hmmm ok.
>
> in my case i'm actually using a single form that i am using to allow a
> user to edit their information. however, they may want to reload that same
> form more than once.
>
> the code you showed me helped me to get the form to show up and i got the
> xhrPost working. now, my problem is that if i attempt to view this form a
> second time, the form shows up but the dojo/dijit functionality doesn't
> appear - and i do see the error you mentioned:
>
> An error occurred: Error: Tried to register widget with id==lineItemSize
> but that id is already registered
>
> can someone help me figure out a way to load the same form more than once
> without reloading the entire page?? :)
>
> thanks in advance
>
>
> MarkDNA wrote:
>>
>>
>> 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.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Dijit-elements-and-xhrPost-tp20276334p22384476.html
Sent from the Zend Framework mailing list archive at Nabble.com.