views:

327

answers:

3

there are two templates i am using for view and edit(is having the form to update), the view will contain edit(link or button), on clicking the edit button i want that the edit template should be loaded (using Ajax, without refreshing the page). and after editing it should be redirected to view again (using ajax same as above). is there any code or method to do that? please help me...

A: 

You can replace your whole content DIV with the result of the AJAX call. In the controller, check if the request is a XMLHTTP request. If so, only return the template without the layout around it.

So you don't change the template, you are just fetching the result of an action via AJAX.

Hava a look the documentation integrating AJAX.

Felix Kling
A: 

You should also consider in-place editing if it'll fit into your design.

sjobe
yeah, i tried that but not working... is there anything, that i should do in Action?? and in div what should i put the form or the data?? i saw this helper in many sites but i am confused...please help...
Harish Kurup
Is the front-end side of things not working or is the value not being changed in the database ?
sjobe
the frontend is not working (hence didnot try the backend..)...and is there anything to do in the controller??
Harish Kurup
actually there are two templates, one which has the view(where we have the edit link/button), and on clicking edit the second template should open i.e edit. where i want to do the edit and on saving it should be back to view template. [the edit template will contain the form element]
Harish Kurup
You've tried any methods like <?php echo input_in_place_editor_tag('edit_me', 'mymodule/myaction', array( 'cols' => 40, 'rows' => 10,))for in-place editing ?
sjobe
yes i did, there was no error it was throwing but not working at all...
Harish Kurup
A: 

I think in-place-edit is best option here. I have used jeditable and jqeury in symfony to achieve similar functionality. Pl have a look at http://myimalert.com/stock_alerts

I could not find native support for in-place-edit in Symfony 1.4.

LionHeart