I want the cell in the table to be the form field ($form[myfield]), which was declared previously as $form['myfield'][$id] = array ( '#type'=> 'select', '#options' => $value_array, '#default_value' => $value[$id], ); So now, using drupal_render($form[myfield]) in the table, I get the select box, and it is populated with $value_array values, but its initial presentation in every row is no value...the default value seems to be ignored. On 09/02/2010 10:59 PM, nan wich wrote:
$form[myfield] is an array. Assuming you only want the value then use $form[myfield]['#value'] or $form[myfield]['#default_value'].
/*Nancy*/
------------------------------------------------------------------------ *From:* Jeff Greenberg <jeff@ayendesigns.com> *To:* development@drupal.org *Sent:* Thu, September 2, 2010 8:20:20 PM *Subject:* [development] Form fields in a table
Using FAPI for a form (D6), and in the form is a markup field, which is a table created with theme(). Some of the cells in the table need to be populated with form fields. The contents of the table is being sent to theme() as $rows, and I've tried having the cells in question defined as $form[myfield] that has been created earlier, but I end up with an empty cell, and the form field appearing where it was first defined, prior to the table... so...
$form[myfield] = array(...
$rows[this_row] = array(cellval, cell2val, $form[myfield] ...
isn't working.
I need something like
Row 1 text text selectbox text textfield text