我一直在谷歌上搜索我的尾巴,但没有运气。
我目前在Drupal7中的表单上使用date_popup,但是提交表单的用户没有要提交的单独日期。他们的标签只显示一个月/年,但是表单也要求输入日期。通常我会说他们可以解决这个问题,但你会惊讶于我收到了多少来自困惑用户的电子邮件。我已将其更改为
$form['made_on_date'] = array(
'#type' => 'date_popup',
'#title' => t('Manufacture Date'),
'#date_format' => 'Y-m',
'#date_year_range' => '-100:+0',
'#required' => TRUE,
'#prefix' => '<div class="can_float">',
'#suffix' => '</div>',
);
这会在单击后从字段中删除日期,但您仍然必须单击月份中的某一天才能关闭弹出窗口。
有没有办法将类型更改为在选择弹出窗口中仅显示月份和年份?我通过Drupal7的Date模块来使用它。
我已经试过'#type' => 'month_popup',
了,但惊讶的是它不起作用。要是。高可用性
发布于 2014-04-17 14:57:56
我不认为date_popup提供了这样做的选项(它主要是javascript)。如果只是选择月份:为什么不使用简单的选择列表或'date_ select '?
使用"date_select":
$form["month_and_year"] = array(
'#type' => 'date_select',
'#date_timezone' => date_default_timezone(),
'#default_value' => date('Y-m-d H:i:s',time()),
'#date_format' => 'm.Y',
);
或者使用一个简单的选择列表:
$form["just_month"] = array(
'#type' => 'select',
'#options' => array(
1 => t("Jan"),
2 => t("Feb"),
...
),
);
https://stackoverflow.com/questions/23120248
复制