Drupal Association members fund grants that make connections all over the world.
I am having a problem with the saving of information to a CCK "select list" text field. I am using Drupal 5.6 and CCK 5.x-1.6-1.
I am doing the following:
I have written a module that gets external information through a RSS feed, splits that information to several parts (Country, City, Description, Title, ...) and then puts these parts in different CCK fields of newly created nodes.
Most of these parts are written to Text – Textfield CCK fields. In this case I use the following code in PHP:
$node = array('type' => 'jobs', 'iid' => $iid);
$values['fieldname'] ['value'] = "data";
drupal_execute('jobs_node_form', $values, $node);
In this case all works perfectly and I can see the data in the CCK -Text – Textfield- fields of the created nodes.
The part "Country" is written to a Text – Select List CCK field that has an allowed values list (all countries in the world). In this case I was not successful to store any information to this CCK field. In the created nodes, the CCK field Country is always empty. I use the same PHP code as above.
I already checked the following:
- The incoming country names are in the allowed values list and are written identically
- The problem still exits if I delete the information in the allowed values list
- The problem is only there if I use a Text – Select List CCK field. If I use a Text – Textfield CCK field instead, the country name is shown correctly in the nodes.
So the problem must be the way in which data is written to Text – Select List CCK fields. Perhaps someone can help me an give me a sample PHP code of how this is done?