drupaldrupal-forms

Creating date field with only month and year - Drupal


I am creating a credit card form in Drupal. I need a date select field where users can select their credit card expiry date, which consists of only Month and Year -No Day.

The Drupal form #type 'date' produces a date chooser, which has day-month-year option. I just need month-year. Any help?


Solution

  • Hey, I found the correct way of doing this. The solution creates a custom form #type element. See http://www.akchauhan.com/create-drupal-form-elements-like-date-element/