I have several CCK fields that I'm exposing in a view. These CCK field have specific "Allowed Values" and are in a CCK dropdown. However, in the Exposed portion of the view it's a textbox. Shouldn't the exposed CCK field be a dropdown even in a view?

Comments

markus_petrux’s picture

Status: Active » Fixed

Look at the list of filters. If you have a Text/Number field, you should see 2 filters for it. Choose the one suffixed with "- Allowed values".

mcaden’s picture

Status: Fixed » Closed (fixed)

Whoa, totally missed that. Thanks a ton.

kbk’s picture

Issue tags: +views, +dropdown, +exposed filters

Added a few tags for forum explorers such as myself.

chien_fu’s picture

It seems that the "allowed values" item is only there if there are infact allowed values..

What if I want it to autopopulate a drop-down with all of the current possible values (distinct)?

Anonymous’s picture

I too need to expose a filter for a CCK field that has no allowed values. I want the dropdown to be of the stored, entered values though...

has anyone accomplished this?

chien_fu’s picture

Status: Closed (fixed) » Active

switching to active for refinement of request.. interested in this functionality with NO allowed values.

hanskuiters’s picture

+1. Need to fill the dropdown filter with the values of a specific cck field

kirilius’s picture

I need that too. In my case the allowed values are dynamically determined by the site activities. Basically the drop-down should be populated from a result of another view.

bandelier’s picture

I've been searching long & far for some help on how I can display a filtered view in a select/dropdown, and control where the "onselect" would take the user. Only thing I have found is that by using the Ctools module combined with Views, you have the option of selecting "Jump Menu" under Basic Settings -> Style. This displays all filtered results in a dropdown list, but alas - you don't seem to have control over where this list goes unless you use a very poorly documented style method (http://drupal.org/node/622740#comment-3976794) which allows an over-ride on the nid so that the selection goes to that node.

My example: I have a long list of companies I want to display in a drop-down - and if someone selects from this list, I want them to be directed to a page/node which I control. This would be the first step in a custom user registration process. If their company is in the list, I don't want them to duplicate the content type, I simply want them to attach themselves to that node. If their company is not in the drop-down, I want them to then fill out the additional information/company information as a content profile - wherein they become the owner of the node.

This has been rattling me for weeks on end - I know there is a solution which allows for control over a drop-down populated by a query, but cannot find it for the life of me.

groovypower’s picture

Subscribing

pieterdc’s picture

Thanks markus_petrux, I also didn't know we had that option.

peterulf’s picture

Subscribing

Anonymous’s picture

+1.
if you set options programmatically instead of doing it in the CCK, it defaults a box and I need to define a dropdowns select list (programmatically also I guess)

jefflogan’s picture

I agree it would be useful for this new feature... to avoid having to do something like the below form alter each time:

/*
*	hook_form_alter()
*/
function modulename_form_alter(&$form, $form_state, $form_id) {

// Check form is exposed filter, object is a view and view name
if ($form_id == 'views_exposed_form' && is_object($form_state['view']) && $form_state['view']->name=='viewname' ) {

// define SQL to fetch content types values - this will differ depending on structure of tables for CCK field - also you may need to alter the query to exclude NULL values if appropriate
$sql = "
SELECT DISTINCT field_contentname_type_value FROM {content_field_contentname_type};
";

// fetch results from database
$result = db_query($sql);
$content_type = array();
$content_type[""] = "<Any>"; //default any option		
while($row = db_fetch_object($result)) {

$content_type[$row->field_contentname_type_value] = $row->field_contentname_type_value;

} //end while

// add filter list
$form['field_contentname_type_value'] = array(
'#type' => 'select',
'#options' => $content_type,
);

} //end if

} //end function
bsandor’s picture

Subscribing

paulgemini’s picture

subbing!

irishjays’s picture

Yes indeed, I have a list of automobiles that changes, but I need the make model and year to be drop down selectable, anyone come across a solution to that prob

kgeographer’s picture

subscribing

sorensong’s picture

+1

chrisla’s picture

Mine switches from a select box to a drop-down if I toggle the "Force single" option on.