Reputation: 257
Good Day, I just want to ask if it's possible to block past dates in TextBox TextMode = "Date"? Thank you guys!
*Update
there is a way to block dates in TextMode="DateTimeLocal"?
If I use Date it's okay, but when I changed the TextMode to DateTimeLocal it's not working.
min=TextBoxArrival.Attributes["min"] = DateTime.Now.ToString("yyyy-MM-dd");
This code is working on TextMode="Date"
This code is from : Mr @Darin Dimitrov
Thank you!
Upvotes: 0
Views: 2392
Reputation: 1039248
You could use the min
attribute:
<input type="date" min="2013-02-24" value="2013-02-24" />
There's also a max
attribute you could use to restrict the maximum date that could be selected in the field.
Also don't forget that this is not validation. You should make sure that you perform this validation on your server and not rely on client side.
Upvotes: 2