I have one page where the user can run some queries, make tables, ...

Now i would like to add a link to this page ('create node from this table')
that redirects the user to a node/add form where the table from the original page is already filled out.

How to do this?

i can only think of:
- passing something in the link ?table=... but this isn't really an optimal solution
- store the table in database on the original page and retrieve it with the node/add form

Any suggestions?

Comments

kenuck’s picture

Have you tried storing your data in a session?

yangke’s picture

thanks

i tried sess_write() and sess_read() functions and this seems to do it.

I will now try to implement the prefilled node/add link. I keep you posted.

valante’s picture

In my use-case, I'm using nodeapi to modify a node's view. Among other things, I'm trying to add a button to "Add items". This button should do the following:

1) Prepare a new-node-of-specific-type form
2) Add to it a value field (with information from the button's form)
3) Display said form to user

Any ideas on how to cobble this together? All help is appreciated.

Thanks,
~ Valante

kenuck’s picture

I"m a bit unclear on what you're trying to do.
You want to display an "Add Items" button when view a particular node?
Once clicked what will it be adding? a new node or just something to be store away?

Take a look at drupal_get_form() .. you can always pass a node->nid to the form that is to be generated via drupal_get_form().

goo luck

valante’s picture

Thanks for the response, netrift.

Actually I'm trying to do the exact same thing that the "book" module does. When you view a book node, there's a link to add a child page. I don't know why I got stuck in my mind that I don't want to pass nid as a parameter in the link, like "book" does.

I'll dig into "book" and see how it's done.