Hi. I'm writing a module that defines a custom node type. The hook_view for my node type displays a table of additional information about the node. Users can add entries to that table using a form. (that form is also generated in hook_view) All that is working. Great.

Now I'd like to allow users to modify rows in the table and I'm unsure what the best way to do that is. I think ideally I'd like to have an "edit" button on each row. When the user presses an edit button, a form would show up below the table where they can make changes.

If that's not possible, maybe the edit button could take the user to a separate page with a form where they can edit the row? After submitting their change, they'd be redirected back to the node.

Are either of these doable? Any suggestions of how this could be done would be greatly appreciated!

-Erin

Comments

Anonymous’s picture

Of course both of them are doable, but I think the second one is much easier since the first one needs some ajax stuff I think.

pixelpixi’s picture

Any suggestions on good ways to accomplish either? I'm not sure what APIs I should look into.

Anonymous’s picture

Just attach an edit link to the end of each row, example if the nid is 7 then the edit url should look something like:

print l('Edit', 'node/7/edit');

Automatically after you save your changes you will be redirected to view the node.