TransWikia.com

How can I replace the date picker with a text field that shows a date picker when it has the focus?

Drupal Answers Asked by user46175 on October 26, 2021

I installed the Date Picker module, which works fine. This is what appears when I add the datepicker element to the form.

screenshot

This is the code I use to add the datepicker element.

$form['date'] = array(
  '#title' => t('Select your birthdate'),
  '#type' => 'datepicker',
  '#date_format' => 'd/m/Y',
  '#date_year_range' => '-100:+0',
  '#default_value' => date("Y-m-d H:i:s", time()),
);

I want to display a text field; when it has the focus, the calendar should be shown.

How should I change the code to make it possible?

One Answer

Have you tried using DatePicker inline module?

From module page:

This module permits inline rendering of date's popup widget. That is, it display the datepicker embedded in the page instead of in an overlay.

It integrates with field API, form API and views exposed filters (via date_views).

Answered by pgrujic on October 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP