Search code examples
jqueryformscloneedit-in-place

Edit in place with jquery and submit updated content through a form


this is my scenario...

In a form, i am using some jquery edit in place to allow users to edit some content. What i need, is for this edited content to be submitted in the form. I thought maybe i can use the jQuery clone function to 'pick up' the div and copy it into a hidden form field, but now i am faced with the problem that although the displayed text is changed, the source code actually stays the same... so im not sure this will work.

Can anyone advice me what i could do? Is there any way i can do this? Any other ideas someone can suggest?

Miro

UPDATE----------------------

Have since managed to get it to update the source code... So now i am left with the second part of the problem...

Is there a way to use the jQuery clone function to pick up a specific div, and copy its entire content into a hidden text field?

Miro


Solution

  • Have you ever tried to use Ajax for those kind of actions?

    please have a look: http://api.jquery.com/jQuery.ajax/

    When the user stop editing something (e.g. focus changed from the field or enter hit) - send $.ajax to you web service and method update data or something like that.