By troy@psknet.com on
All,
I can't seem to put my finger on this. I have a simple form with three fields. It works perfectly, until I create a theme() function for it. Here's the form code:
$form['term'] = array (
'#type' => 'textfield','#title' => 'Query String',
'#required' => TRUE,'#default_value' => $term,
'#autocomplete_path' => 'staff/autocomplete',
'#size' => 32,'#maxlength' => 128);
$form['type'] = array(
'#type' => 'select','#title' => 'Type','#default_value' => $type,
'#options' => array ('callhistory' => t('History'),'authlog' => t('Authentication')));
$form['when'] = array(
'#type' => 'select','#title' => 'When','#default_value' => $when,
'#options' => array (
'today' => t('Today'),'yesterday' => t('Yesterday'),
'week' => t('This Week'),'lastweek' => t('Last Week'),
'month' => t('This Month'),'lastmonth' => t('Last Month')));
$form['submit'] = array('#type' => 'submit','#title' => 'blah','#value' => t('Go'));
Here's the theme code:
function XXtheme_staff ($form) {
$output = '<table border="0" cellpadding="0" cellspacing="0"><tr><td>';
$output .= form_render($form['term']);
$output .= '</td><td>';
$output .= form_render($form['type']);
$output .= '</td><td>';
$output .= form_render($form['when']);
$output .= '</td><td>';
$output .= form_render($form['submit']);
$output .= '</td></tr></table>';
return $output;
}
Any suggestions on what I can do without going directly to $_POST[edit][term]? (yup, it's there).
Thanks,
Comments
Try adding form_render($form); before return $output;
Try adding form_render($form); before return $output;
Laszlo
Solution for $form_values being empty in 5.1
The recommended solution works in 5.1 also with the slight modification of calling
drupal_render($form)instead ofform_render($form).