2

I am currently using the JQuery datepicker, however it doesn't appear to enforce the input of only valid dates. Is this possible? For example, it will allow me to manually enter 22/22/22 into the date field. As a last result is it possible to only allow users to enter a date via the picker popup?

Thanks

user460667
  • 1,870
  • 3
  • 19
  • 26

2 Answers2

3

Try using the jQuery UI Datepicker Validation plugin. It works with the jQuery Validation plugin and provides the exact functionality you are asking for.

betamax
  • 13,431
  • 9
  • 38
  • 55
1

try this ideas

<input type='text' id='date' readonly='true'>

or

$("#date").keypress(function(event) {event.preventDefault();});

or

$("#date").attr( 'readOnly' , 'true' );

more details here jQuery Datepicker with text input that doesn't allow user input

Community
  • 1
  • 1
Naga Harish M
  • 2,779
  • 2
  • 31
  • 45
  • 1
    use **$("#date").keypress(function(event) {event.preventDefault();});** it is most recommended. no need to add any jquery plugin – Naga Harish M Aug 05 '11 at 10:51