I would like to set a custom input filter for CCK Currency.

I can now select both amount and currency but both are text inputs. I'd like to have a available currency select input with a limited options of currencies I am using, paired with a text input for the amount.

It would be even greater to have two text inputs to be able to define a range of amounts (i.e. from 20€ to 100€).

I haven't been able to found anything in this module nor looking for theme/module overrides. Some help on this?

Thank you

Comments

Anonymous’s picture

I solved the range by setting the operator to In between.

I am trying to set the available currencies programatically like this:


function mymodule_form_alter(&$form, $form_state, $form_id) {
	/** Modificar el formulario exposed de Views */
	if ($form_id == 'views_exposed_form') {
		$form['field_1hour_currency']['#type'] = 'select';
    		$form['field_1hour_currency']['#options'] = array('EUR','USD');
	}
}

But I get a An illegal choice has been detected. Please contact the site administrator. error in the view.

How can I fix this?

Anonymous’s picture

Status: Active » Closed (fixed)

Solved:

function mymodule_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'myview') {
    // Add our custom All buttons.
    $form['field_1hour_currency']['#type'] = 'select';
    $form['field_1hour_currency']['#options'] = array(
      '' => t('<Any>'),
      'USD' => 'USD',
      'EUR' => 'Euro'
    );
  }
}

Thanks to Tom at http://drupal.stackexchange.com/questions/3518/custom-cck-currency-expos...