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:




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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.