0

I would like to know if it's possible to populate a node fields with the values from form_state or something like that.

Basically what I do is to show a register form merged with a form from a Content Type. I do that by using field_attach_form(). Now on submit I create a node using:

$node = new stdClass(); $node->type = 'company'; $node->uid = 1; node_object_prepare($node);

and now I would like to get all values from form_state and put them into the node.

Many thanks!

1 Answer 1

0

Hook your form, add new submit handler and place your code there.

Sign up to request clarification or add additional context in comments.

4 Comments

And the values to insert in the node? How do I put them there?
Thanks for answering, but I don't think you understand my question. I know how to create a node pragmatically; the problem I have is that I need to put the values from the $form and $form_state in the node. Without doing something like: $node->title = $form['bla bla]; I would guess something like creating an object from $form and then do node_save($that_object);
Also, I've tried something like node_form_submit_build_node($form, $form_state);but with no results. It just gives me a blank page.
A-ha,...sorry then. I manually read and store values as you explained. Don't know for any other way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.