This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

problem Ajax

Other symfony projects

problem Ajax

by clad » Thu Apr 03, 2008 10:07 am

Hi everybody.

I'm using symfony and Ajax in a project and i have a big problem.
When i submit a form in ajax, update mode duplicate the div.So if i submit ten times , i have ten div.For performance reason and to have clear code, is there a solution?

i show you a part of the code:


<?php echo form_remote_tag(array(
'update' => 'container',
'url' => 'client/updateAjax',
)) ?>

...

<?php echo submit_tag('sauver') ?>



and the css:

#container
{
border:1px solid black;
width:500px;
margin-left:auto;
margin-right:auto;

}


As it duplicate div ,it duplicate also border...
I've ever tried a submit_to_remote it's the same....

Is there a solution to have only one div when submitting?

Thanks by advance.

clad
clad
Junior Member
 
Posts: 23
Joined: Thu Apr 03, 2008 9:52 am

Re: problem Ajax

by Junni » Thu Apr 03, 2008 10:24 am

Perhaps there is a better solution but: put a second div in the "container" div and update that one?
Junni
Member
 
Posts: 96
Joined: Wed Jan 17, 2007 3:52 am
Location: Belgium

Re: problem Ajax

by clad » Thu Apr 03, 2008 10:30 am

I' ever try to put on other div but :
first it's not very clear.
second it don't solve the problem because it duplicate the second div also.
apparently when we use an update on a div which is display, there is a duplication... :(~ :-(~ :sad:
but thanks for your reponse...

if you put an other div whith the css of the first one and you clear the css of the first div, when you update the second div you have only one border but always several div.....
clad
Junior Member
 
Posts: 23
Joined: Thu Apr 03, 2008 9:52 am

Re: problem Ajax

by Junni » Thu Apr 03, 2008 10:33 am

What's the result of the client/updateAjax action? Is the "container" div also located in the template of this action?
Junni
Member
 
Posts: 96
Joined: Wed Jan 17, 2007 3:52 am
Location: Belgium

Re: problem Ajax

by clad » Thu Apr 03, 2008 10:48 am

No there is only one existing container in listAjaxSucess (container is not empty ).

Code of editAjax is the same of edit crud but in ajax.

I'v tried to modify crud existing in ajax...


this could be a solution (the div 'zone_creer' is in the div 'container') but i can't use update....


<?php echo submit_to_remote('ajax_submit','Sauvegarder', array(
'url' => 'client/updateAjax',
'loading' => "Element.show('indicator')",
'complete' => "Element.hide('indicator');Element.hide('zone_creer');".visual_effect('blind_up', 'zone_creer',array('duration' => 0.5))
)) ?>


If someone has a solution with the update...

junni thanks for your responses.
and sorry for my english ...
clad
Junior Member
 
Posts: 23
Joined: Thu Apr 03, 2008 9:52 am