Using ajax to edit/save nodes ?

thorie79 - May 30, 2008 - 01:04

I am trying to edit/save nodes on a certain spot on my page using jQuery + Ajax.
I was able to kind of get it working using drupal_json() and drupal_get_form().

The function drupal_get_form("mynodetype_form") is able to get the form and all my fields. This works great.

But, when I tried to do:

$node = node_load($nid);
drupal_get_form("mynodetype_form", $node);

This didn't give me the form for the existing node for editing, like I wanted. Instead, it just gave me the blank form again.

Is there another (better) way to be doing this? This question isn't really related to ajax/jquery but I threw that in since it might help to know what I am ultimately trying to do.

How can I get the editing version of a form (with prepopulated values)?

ajaxtable

JohnForsythe - May 30, 2008 - 01:33

You might want to check out AJAX Table, it comes with some demos that deal with AJAX node editing.

--
John Forsythe
Need reliable Drupal hosting?

I don't know if this is what

meric - June 3, 2008 - 07:50

I don't know if this is what you want, but you can do:


<?php
//let's load an edit page
$node = node_load($nid);
$output = node_page_edit($node); //store the html in a variable, like $output.

//we can try to print it
print $output;
?>

node_page_edit returns the HTML markup of the [form] element of the edit page for the specified node..

Hope this helps.

Editing and Saving nodes with Jquery

nicesukhi1 - July 11, 2008 - 07:26

Can you tell me thorie79 how to edit/save node with jquery? As i also need to make like this.

 
 

Drupal is a registered trademark of Dries Buytaert.