Hi!
I have a custom content type ('cars') with a CCK field ('year'), and that field is stored in it's own table called 'content_field_cars_year' in the database.
Now, after a user has clicked on the 'Submit'-button on a 'Add Cars'-form, and Before the 'year' value is saved to the database, I'd like to make a final change to the value of the 'year'-field.
Adding a custom submit function to the #submit array of the 'Add Cars' form does not work, because the CCK fields seems to be processed before any #submit functions are called.
I already have a custom module ('Form Overrides') with form_hook_alter implementations on some forms, and I'd like to do these modifications in this module.
If ideas popup, please reply!
Comments
Comment #1
DrupalNovice commentedSolved this myself.
Two possible ways of achieving this everyone:
Method 1: Use the Computed Field module, and add the code to that field.
Method 2: Use hook_nodeapi and filter down to the form by a switch-case on $node->type, and after that add an if-statement to filter the code only to execute when the form is submitted. My favorite - no other module dependencies, just pure Drupalcode.
Hope this will help someone!
Comment #2
DrupalNovice commentedComment #3
DrupalNovice commented