Closed (fixed)
Project:
Content Taxonomy
Version:
6.x-1.0-beta5
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
6 Jan 2009 at 11:51 UTC
Updated:
1 Sep 2010 at 13:32 UTC
Hello,
Im having problems adding values to my content_taxonomy field using drupal_execute();
For other cck fields i would use
$form_state['values']['field_myfield'][0]['value'] = $myvalue;
but for content taxonomy fields this is not working.
any suggestions?
Comments
Comment #1
mh86 commentedare you using term ids for the $myvalue?
and which kind of widget are you using? the structure for autocompletes might look a bit different
Comment #2
loze commentedIm using term ids, I tried as both a string and an integer.
Im using a single value select list
The field is required on my form (if that matters)
ive tried just about every thinkable variation of the array
like
$form_state['values']['field_myfield']['value']
$form_state['values']['field_myfield']
$form_state['values']['field_myfield']['value'][0]
etc.
even tho they didnt seem right.
Comment #3
loze commentedok, this is weird.
i still cant save the correct values to the dropdowns.
however
$form_state['values']['field_myfield'][0]['value'] = '2192';
is saving a value of '2'
the first character?
Comment #4
mh86 commentedthe select boxes of content taxonomy are based on the optionwidgets of cck. so it should work the same way as it does with cck select boxes.
maybe you can do some debugging?
Comment #5
loze commentedthanks mh86,
Yes it does appear that im having the same problem for all CCK select elements, this doesnt appear to be content taxonomy specific.
If i figure it out ill post back.
Ive searched on here and found some suggestions, but none seem to work for me.
so for my project right now, im going to use node_save()
it seems to work for what i need.
thanks for your time.
Comment #6
marqpdx commentedhi, i'm running into this as well.
subscribing.
thx,
m
ps -i'm now updating my content table as well as term_node to get around this.
Comment #7
peter törnstrand commentedHaving the same problem. If works as expected when only one node is created per CRON-run. But if I create multiple nodes on a run I get the problem described in #3.
Here is what I found.
#416126: CCK text field select list options widget data incorrect when call drupal_execute() more than once
#260934: Static caching: when drupal_execute()ing multiple forms with same $form_id in a page request, only the first one is validated
Work around for this: http://drupal.org/node/260934#comment-1179304
Comment #8
TheThumbPuppy commentedI'm having the same problem and I have tried unsuccessfully with:
$form_state['values']['field_myfield'][0]['value']
Have you found a solution for this?
Thank you in advance
Comment #9
TheThumbPuppy commentedWith the help of theme developer from the Devel module, I was able to find out the names of the Content Taxonomy form fields, which in my case were:
I have then used the following lines:
drupal_execute saves now the nodes with the correct values for the Content Taxonomy fields.
I hope that these quick notes will be of some help.
Comment #10
magnus commentedPlease reopen issue if problem still exists.