How to change a CCK value from a custom module I would like to change a CCK value from an action triggered by the user. I built a custom form with a submit button that leads to a hook_validate(). I would like to update a field value from my function. I know the nid and the field_name, I can't find how to do it using CCK API.

Any ideas ?
With the nid stored in $nid and changing FIELD_NAME to your specific field name, once you have your new field info back from your form nicely stored in $new_info all you need to do is:

$node=node_load($nid);

$node-&gt;FIELD_NAME[0]['value']=$new_info;

node_save($node);


This is assuming a couple things, one that it's the first value in a field, the [0] up there, and that the field is one that has a ['value'] component.  Other types of fields have different things here, the most common that immediately comes to mind is ['nid'] if it's a reference field.