Hi, I've made a custom node type for keeping track of movie reviews and have a Free Tagging taxonomy called "Movie Cast" where the names of actors are placed. The default 'maxlength' is 100 (not 128 as stated in the form api's reference) but it is too short for a list of cast members. I want to change the 'maxlength' to 1024.
If I test a new form field with a unique field name, I can see the cast form and autocomplete works fine. However, when I change the field name to overwrite normal taxonomy generated field, my customized form disappears and I'm stuck with the original field with 'maxlength' of 100.
Overwriting the 'body' works fine. Please help me out!
Custom field to replace the default taxonomy:
$form['taxonomy']['tags'][$cast_vid] = array('#type' => 'textfield', '#default_value' => $node->cast, '#maxlength' => 1024, '#autocomplete_path' => 'taxonomy/autocomplete/'.$cast_vid, '#required' => TRUE, '#title' => t('Movie Cast is working!'), '#description' => t('A comma-separated list of the English spelling of actors and actresses in this movie.'));
Custom field to replace the 'body'
$form['body'] = array('#type' => 'textarea', '#title' => t('Movie Review'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE, '#weight' => -1);
How do I overwrite the field?
Comments
I have run into this same
I have run into this same problem using a form_alter to replace the Folksonomy field with a homemade widget. I basically take the original field and make it hidden and strip some of the fields (like #autocomplete_path and #require), adding a prefix and suffix, and rendering it through the normal forms API. Everything looks the exact same in $_POST between original and new from what I can see, but for some reason or another my widget's value isn't taken.
Any thoughts out there?
-Craig A. Hancock, ZCE
(a.k.a. fractile81)
Order
Does your modules form_alter hook run before or after the taxonomy module is invoked? To have it run after taxonomy increase your module's weight in the system table.
--
The Manual | Troubleshooting FAQ | Tips for posting | Make Backups! | Consider creating a Test site.