我有两个html文本框控件.在这两个文本框中,我都将仅从日历控件中输入日期,两个文本框均为只读.我想限制用户在第二个文本框中输入较高的日期.

问题描述:

我有两个html文本框控件.在这两个框中,我都将只输入日历中的日期,两个文本框都是只读的.我想限制用户在第二个文本框中输入更高的日期.


请给我代码.

I have two html text box control.In both i will enter only date from calender control,Both the textboxes are readonly.I want to restrict the user to enter higher date in second text box.


Please give me the code.

这根本没有意义.遵循简单的逻辑:如果两个文本框都是只读的,那么您已经限制了用户根本不输入任何内容,而不仅限于日期.请记住,只读"控件实际上意味着阻止任何用户输入.

我需要添加一些积极的东西吗?当然.建议如下:不要使用文本框,而是要给用户一个很大的帮助,并提供一个DateTimePicker.例如,考虑以下示例: DateTimePicker Web控件 [
It makes no sense at all. Follow the simple logic: if both of the text boxes are read-only, you already restrict the user from entering anything at all, not only the date. Remember that "read-only" control really means preventing any user input.

Do I need to add something positive? Certainly. Here is the advice: instead of using text boxes, do your users a great favor and provide a DateTimePicker. For example, consider this one: DateTimePicker Web Control[^].

It will greatly improve things but probably won''t solve your problem. As one of the possible alternatives, consider this: use DateTimePicker to input some point in time, and for the second time point, allow the user to enter the time span, say, in seconds or days, or whatever is more appropriate. This way, the constraints will be reduced to the problem of entering a non-negative value (or negative or 0, whatever), which is much simpler and more clear for the user.

—SA