I have a content type called Event, which has a date field. I created a new view for the content type and added filtering by date as filter criteria. If I enter inside filter configuration I can choose the operator and enter the value inside the input. What I need to do is to split this input into three sepparate inputs for day, month and year. I need to do this inside a custom module. I need to add the value from the admin interface but modify the input via code. Any help would be appreciated.
0
votes
1 Answers
0
votes
You can do the form alter and change the format,
do this in custom module,
<?php
function mymodule_form_alter(&$form, &$form_state, $form_id){
...
if($form_id == 'views_exposed_form'){
if($form['#id'] == 'views-exposed-form-events-all-search-panel-pane-1'){
$format = 'm-d-Y';
$form['date_filter']['min']['#date_format'] = $format;
$form['date_filter']['max']['#date_format'] = $format;
}
...
}
OR you can try Better exposed filter module.
Project page says:
What's new?
The 7.x release now includes support for the jQuery UI Datepicker instead of a textbox for date-related fields. Since Drupal 7 ships with jQuery UI in core, my hope is to start offering these as options in BEF. If you have any suggestions, please add a feature request to the issue queue.
(Note: Support for fields supplied by the Date module is a little funky until #392836: Exposed Date filter format (in Views) and/or Date format in exposed filter (views) are resolved).