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 ();}};