So the custom filter works (apparently), but I keep getting an error "Bad arguments. in includes\form.inc on line 618". Any help would be much appreciated.

function phptemplate_views_filters($form) {
	$view = $form['view']['#value'];
	foreach ($view->exposed_filter as $count => $expose) {
		
		if ($expose['label'] == "Trial ID") {
	   		
			$label = '<strong>'.$expose['label'].'</strong><br/>';
			
			//The select box
			$query = "SELECT field_id_number_value FROM content_type_open_cancer_trial";
			$result = mysql_query($query);
			$options = array();
			$options["***ALL***"] = "<All>";
			while ($row = mysql_fetch_array($result)) {
				$options["$row[field_id_number_value]"] = $row['field_id_number_value'];
			}
			
			$form["filter$count"] = array(
										'#type' => 'select',
										'#name' => 'filter0',
										'#id' => 'edit-filter0',
										'#default_value' => '<All>',
										'#options' => $options
										);
	   		$formelement = drupal_render($form["op$count"]) . drupal_render($form["filter$count"]);
	   		$o .= '<div class="form-element-'.$count.'">'.$label.$formelement.'</div>';
			
		} else {	
	   		$label = '<strong>'.$expose['label'].'</strong><br/>';
	   		$formelement = drupal_render($form["op$count"]) . drupal_render($form["filter$count"]);
	   		$o .= '<div class="form-element-'.$count.'">'.$label.$formelement.'</div>';
		}
	}
	$o .=  drupal_render($form['submit']);
	
	return $o . drupal_render($form);
}

Comments

ainigma32’s picture

Status: Active » Fixed

I'm guessing that the $form array you're passing to drupal_render is not in the expected format.

But to find out where things are going wrong exactly you should do a little debugging: http://www.lullabot.com/articles/quick_and_dirty_debugging

Judging from the age of this post I'm going to assume you got this fixed already.

If not feel free to reopen.

- Arie

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.