Search code examples
polyfillskeyboard-navigationwebshim

Keyboard Input with Webshim's Date Picker


I am using the webshims library to support older browsers better with more modern features. While the date picker works great with the mouse I seem to be having problems using it from the keyboard. The easiest way to see this is visit the demo page. I am using Firefox since it doesn't have date support.

Without making any modifications try to type in a date. I can enter numbers but I cannot enter a "/". If you enable the placeholder it even suggests the slash. I tried leaving out the separator or using "-" (which it lets me type) but when the form submits I get no value.

How are you supposed to enter a date via the keyboard?

For bonus points is it possible to allow the date picker to not enforce a format? I have backend code that can parse a wide variety of date formats. So they can use the date picker if they wish but if they type something in then whatever they type in is sent onto the server without modification.


Solution

  • Try this.This works for '/' format..

     $.webshims.formcfg = {
          en: {
            dFormat: '/',
            dateSigns: '/',
            patterns: {
              d: "mm/dd/yy"
            }
          }
    
        };
        webshims.activeLang('en');