I need to embed the edit form for an existing CCK node inside a page that is generated by my module. The module page displays customer information at the top of the page. Below that information, I need to present the node edit form for an ongoing session. The form will be partially filled by the customer service rep some time before the appointment, so I can't just load a new edit form. I have to load the particular node for that customer, as an editable form inside the existing page.

Thanks,

Doug Gough

Comments

mdixoncm’s picture

Assuming you already have the node you are wanting to edit loaded into the variable $node, then you can just do it using the standard node_edit form ...

something like ...

$output .= drupal_get_form($node->type .'_node_form', $node);

obviously you will have the problem of what happens when you submit the node (you will be returned to the node view page - which might not be what you want) - you could probably solve this by adding a destination query string param to your module's page's URL.

Hope that helps ...

Computerminds

Anonymous’s picture

thanks. that's what I needed.

amcc’s picture

exactly what i needed too, thankyou for keeping me from pulling my hair out mdixoncm. As far as the destination goes - i'd already set up Workflow-ng to redirect me to the page i wanted to go to. Then (with your help) i put that edit page as a tab in my user profile and Workflow still picks up the node and redirects me in the correct manner.

For the sake of completeness if you could let us know how you'd set the destination that would be good to know

buchannon’s picture

Thanks! I was googling for a while on this and this is exactly what I was looking for.