Search code examples
jqueryvalidationdatedatepickerjquery-ui-datepicker

Jquery date picker restrict dates like 2222222/33333/444444


I am using Jquery Date Picker in my MVC 3 + Razor project.

I have successfully been able to use and integrate it with my project.

Using date picker now I can see that it does not allow characters like a,b...@#,$,%.. and so on. But it does allow number, to understand what I mean see the screenshot,

I think I need to make some changes in the jquery itself, but I dont know where. Please help me out on this one.

enter image description here

enter image description here

With help of marcolinux, I have used http://keith-wood.name/uiDatepickerValidation.html, and now when I have added this to my script

        $(form).validate({
        rules: {
        startDate: {
        dpDate: true
        }
        }
        });

and imported this link

 <script src="../../Scripts/jquery.ui.datepicker.validation.js" type="text/javascript"></script>

I have made more progress in this now using class="dpDate" in my textbox now I am able to get a red border on my text box for input like 1212635245 111/12313/12313

now the last part I need to know is how to show a error message next to textbox.


Solution

  • Put in an attribute readonly="readonly" Should solve the issue :)