1

how do I Set default value for taxonomy list? I have tried altering form with the following line included, but it didn't work:

$form['taxonomy'][3]['#default_value'] = 6;

3 is my VOC ID and 6 TID that I want to select as default

  • Which version of Drupal ? – yvan Oct 17 '11 at 15:40
  • I am using Drupal 6 – Luca Oct 17 '11 at 15:46
3

If you are using hook_form_alter I believe this will work

$form['taxonomy'][3]['#default_value'] = array(0 => 6);

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.