Drupal 6 custom submit function to alter submitted node data

1k views Asked by At

I have written a module that uses hook_form_alter to add a custom submit function to the node form. This function is not intended to remove the original node submit function, it is there simply to alter node data before it is inserted into the database.

The problem is that when I print_r the posted form array from inside my module when a node is added, the array is massive and it seems the posted data repeats numerous times. I need to know, which part(s) of this array I should be altering so that my altered values are inserted into the database.

To expand a little bit, the module works in the following way: My module attaches a custom submit function to the node form. A user submits a node (containing numerous CCK fields). Some of these fields are left empty. My custom submit function finds these fields and adds a value to them. The node is then inserted into the database.

The module and function I am using work perfectly, but I just can't seem to find what part of the submitted array needs to be altered so that the custom data will be inserted by the node module's own submit function. I would post the array but due to the size, it's probably not advisable, although if anyone would like it I could send it somehow.

Finally, I know there are easier ways of doing similar to what I am trying to achieve but unfortunately this is the only option in the circumstances.

1

There are 1 answers

0
Jamie Hollern On

Apologies for wasting anyone's time, I was looking at the $form array when in fact the submitted values are stored in $form_state['values'].