I am working on dynamically creating nodes with pollfields, but don't know what the node array should look like for the pollfield field. I've got all the other CCK fields importing just fine from a php script, but I don't know how to make the node array look. I've tried the following, but it is not working. Thanks for the help.

      $node['field_poll_test']=array(
                                           array(
                                                 'active'=>'1',
                                                 'runtime'=>'0',
                                                 'question'=>"ask a question",
                                                 'choice'=>'answer1',
                                                 'votes'=>'0'
                                                 ),
                                           array(
                                                 'active'=>'1',
                                                 'runtime'=>'0',
                                                 'question'=>"ask a question",
                                                 'choice'=>'answer2',
                                                 'votes'=>'21'
                                                 )
                                           );

Comments

dgraver’s picture

Title: What is the format for dynamically creating pollfield » Answer...

$node['field_poll_poll1']=array ( 'active'=>$active,
'runtime'=> $runtime,
'question'=>'question?',
0=>
array('choice'=>'choice1',
'votes'=>'23'),
1=>
array('choice'=>'choice2',
'votes'=>'22')
);

dddave’s picture

Status: Active » Closed (fixed)

cleaning up