Posted by caelon on May 3, 2011 at 1:09am
I've taken over maintenance of a site and am trying to make a specific change. There is a form that is used to create a node but one of the fields is free-form text. They want this field changed to multi-select of taxonomy terms. I think I need taxonomy_form but haven't had much success implementing it yet. Does anyone have really good links (besides api.drupal.org) for taxonomy_form?
One possibly important piece of info: CCK is not installed for the handling of content types.
There's probably a thousand other small details that are needed but I think a good explanation of taxonomy_form (or one of its brethren) will get me most of the way home.
Thanks in advance.

Comments
taxonomy already?
Don,
Is the current free-form text field a taxonomy field already? If so, why not just change the taxonomy settings?
-mike
No, the free-form is not a
No, the free-form is not a taxonomy field, per se. It's part of a custom form that, through some submit logic, saves to a custom table and has additional logic that adds the term(s) to the taxonomy.
Soneone else who I talked through this felt it might have been written in v6 by some people familiar with v5 and doing it that way. They felt that might explain the fact that CCK wasn't used.
That's the short answer. I've expounded a bit below if anyone cares to read.
Classic _form using FAPI. When submitted, calls a function that takes the $_POST variables and saves them to $form_state. It then uses module_load_include to grab the node.pages inc file and drupal_execute on the form, $form_state and $node to create the node.
I think that implementation is what's inhibiting the change. When I change the FAPI field to a multiple select, the drupal_execute likely expects an array but has now place to save it because it's just a text field in the DB. If I process the array to create a comma-delimited string, it fails - I think because it expects an array. My logic is that if I can move it to taxonomy, then it can save to term_node and not worry about the actual field but I'm having no luck implementing it.
Don VanDemark
Agile Process Manager, Blue Shield of California
wow
Here's what I would do (assuming I understand the issue correctly):
It's a rip-off-the-bandaid type of thing. Don't try to "fix" the old code - eliminate it. Change it to work the "right" way and let the migration script be the hard part - it only has to work once then you're done with it.
-mike
You've probably understood
You've probably understood the issue correctly, or at least as well as I have explained it.
Thanks for the advice.
Don VanDemark
Agile Process Manager, Blue Shield of California