Datepicker: Fully Constrain Input

Datepicker: Fully Constrain Input

Hi,

One issue that I dealt with is constraining a user to pick a date from a datepicker and not allow any input into the input field.  I'm aware of the constrainInput option, but this allows a user to still enter any amount of valid characters.  For example, a user could type 12///333///444/555/666 in the field and it would stay there on blur.

There are a couple of work arounds but I am looking for help/suggestions.
  • One option is to add a read only option to the input.  This works great, but it turns the input gray in some browsers making it appear disabled to users.  I try to overcome this with css but seems a hassle and I have validated it in many browsers/OSs.
  • Another option is to return false on the key up/down/press event.  This is tricky because of cross browser support of these events.  Also, without filtering, you are preventing all keys when some (esc, tab, enter, etc.) should likely be allowed.
Any suggestions???  I think this should really be the default behavior of the datepicker.

Thanks,

Dave











    • Topic Participants

    • dave