Greg 303 Greg 303 - 9 months ago 40
jQuery Question

Silverstripe datepicker in frontend form only working in Chrome

I am using the datepicker that comes with Silverstripe in an front-end form. I am also using the BootsForm Module. This is the code that works in Chrome:

->setAttribute('type', 'date')
->setAttribute('data-datepicker', true)
->setAttribute('data-date-format', 'DD-MM-YYYY');

The birthdayfield is a datefield. The datepicker is not showing in Firefox or Safari. I don't know why. I get no errors in the browser console. I am sure, i am not the first person with this problem. So maybe someone can point me in the right direction.

Answer Source

This is not really a SilverStripe issue. You're just creating a HTML5 date-field and set the datepicker attributes. Most browsers don't support native date-pickers (yet), see

You could add some JS that progressively enhances your date-field with a date-picker though. Here's a tutorial that uses jQuery UI. If you're not using jQuery/jQueryUI, Pickaday is a good alternative.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download