How does the ext.net date control specify that the control can only select a date after the current day?

Source: Internet
Author: User

today, I met one. How can I restrict the date control to a date later than the current day, the example on the official website is a date comparison between two controls. I thought about it and got a coincidence. I also got two date controls, but they were hidden. The hidden default value is assigned to the current day, this is similar to the date on the official website. Haha ~

<Ext: datefield id = "datefield1" runat = "server" vtype = "daterange" fieldlabel = "to" hidden = "true" anchorhorizontal = "100%" enablekeyevents = "true"> <customconfig> <Ext: configitem name = "enddatefield" value = "# {plandate}" mode = "value"/> </customconfig> <listeners> <keyup fn = "onkeyup"/> </listeners> </ext: datefield> <Ext: datefield id = "plandate" runat = "server" vtype = "daterange" fieldlabel = "scheduled date" enablekeyevents = "true" format = "Y-m-d" width = "250px "> <customconfig> <Ext: configitem name = "startdatefield" value = "# {datefield1}" mode = "value"/> </customconfig> <listeners> <keyup fn = "onkeyup"/> </listeners> </ext: datefield>

 

The first datefield sets the hidden = "true" hidden attribute. For details about how to assign a default value to the control, refer to the blog article ext.net date control default value assignment.

Here is an onkeyup JS verification, which is to verify the date comparison of the two date controls.

 

 
VaR onkeyup = function (field) {var v = This. processvalue (this. getrawvalue (), field; If (v. length <1) {If (this. startdatefield) {field = ext. getcmp (this. startdatefield); field. setmaxvalue (); this. daterangemax = NULL;} else if (this. enddatefield) {field = ext. getcmp (this. enddatefield); field. setminvalue (); this. daterangemin = NULL;} field. validate ();}};

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.