I have some CCK select list fields which I do not define allowed values for.

I need to set the options available using information available to me when the form is being loaded.

I tried setting the values in the node-form.tpl file but I get:

"An illegal choice has been detected. Please contact the site administrator."

for each field I set the allowed values for in this way.

What's the proper way to do this?

1 Answer 1


check this resource http://drupal.org/node/726282 you will find a very useful description about CCK fields when form is loaded, and his relation with the function to alter forms, called hook_form_alter(). In few words, you must also use an after_build() function.

  • Awesome. Doing the same operations I was doing, but this time in after_build() fixed my problem. Thank you!
    – Joren
    Commented Aug 19, 2011 at 0:18

Your Answer

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

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