I have 1000 records of users with name and checkbox. I want to show the list of users in table theme. I have use
theme('table', array('header' => $header, 'rows' => $rows));
But how to use it with multistep form. Please find the below code.
function getForm() {
$form = array();
$step1 = array();
drupal_add_js("
function checkUncheckAll(theElement){
var theForm = theElement.form, z = 0;
for(z=0; z<theForm.length;z++){
if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
theForm[z].checked = theElement.checked;
}
}
}", 'inline');
$step1['user'] = array(
'#type' => 'container',
'#tree' => TRUE,
'#prefix' => '<div id="user">',
'#suffix' => '</div>',
);
$results = db_query("SELECT* FROM {user_token} ut LEFT JOIN {users} u ON u.uid= ut.uid where u.status=1 and u.uid!=0 group by ut.uid ")->fetchAll();
foreach($results as $k=>$result)
{
$user[$result->uid] = $result->name;
$defaults = array_keys($user);
}
$step1['checkall'] = array(
'#type' => 'checkbox',
'#title' => t('Select / Unselect all'),
'#attributes' => array('onclick' => 'checkUncheckAll(this);'),
'#weight' => -1,
);
$step1['user'] = array(
'#type' => 'checkboxes',
'#title' => t('Send message to listed users'),
'#options' => $user,
//'#default_value' => $defaults,
'#attributes' => array('class' => array('check_notify_user'))
);
$step1['submit']=array(
'#type'=>'submit',
'#value'=>t('Next')
);
$form[] = $step1;
$step2['message'] = array(
'#type' => 'textarea',
'#title' => 'Message',
'#description' => t('No more than 250 words please!'),
'#wysiwyg' => false,
'#attributes' => array('maxlength' => 250),
);
$step2['prev'] = array(
'#type' => 'submit',
'#value' => t('Previous'),
'#name' => 'prev',
'#submit' => array('custom_previous_submit'),
);
$step2['submit']=array(
'#type'=>'submit',
'#value'=>t('Submit')
);
$form[] = $step2;
return $form;
}