I'm trying to filter my nodes on the basis of last 7 days & last 30 days but the below code is not working for me when I tried this in my custom module, its working as a conversion for text-field to select but not working as a filter

function dreamzen_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
    $fromdate = &$form['created'];
    $fromdate['#type'] = 'select';
    $fromdate['#options'] = array(
      'All' => 'All',
      'Last 7 days' => '-7 days',
      'Last months' => '-30 days',
    $fromdate['#default_value'] = '';
    $fromdate['#size'] = 1;

1 Answer 1


are you checking, value is equal to '-7 days', it must match to the value of select box.

Hope this may help full.

  • "it must match to the value of select box?" Sorry but I didn't got it, can you please elaborate it? Jun 17, 2013 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.