问题描述
美好的一天,我只想问,如果有可能阻止过去在文本框的TextMode =日期的日期?谢谢你们!
Good Day, I just want to ask if it's possible to block past dates in TextBox TextMode = "Date"? Thank you guys!
*更新结果
有一种方法来阻止的TextMode =DateTimeLocal的日期?
如果我使用日期也没关系,但是当我改变了的TextMode到DateTimeLocal它不工作。
*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.
敏= TextBoxArrival.Attributes [分钟] = DateTime.Now.ToString(YYYY-MM-DD);
结果
这code正在研究的TextMode =日期结果
这code是:先生@Darin季米特洛夫
min=TextBoxArrival.Attributes["min"] = DateTime.Now.ToString("yyyy-MM-dd");
This code is working on TextMode="Date"
This code is from : Mr @Darin Dimitrov
感谢您!
推荐答案
您可以使用的属性:
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.
这篇关于HTML 5,ASP.NET 4.5文本框的TextMode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!