Apr 14, 2015, 1:55 PM
[CLOSED] [#786] [3.2.0] DateRange validation
On the following example https://examples3.ext.net/#/Form/Dat...From-To_Range/, field is validated and Min and Max values are updated on its KeyUp event. I remember that it was required but at this time, after some tests i think that it's not required anymore.
Daniil, can you confirm that?
In addition, it would be nice if it were done internally (if it's still required), as shown below:
Daniil, can you confirm that?
In addition, it would be nice if it were done internally (if it's still required), as shown below:
<!DOCTYPE html>
<html>
<head runat="server">
<title>Multiple DateFields with DateRange Validation - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
<script>
Ext.form.field.Date.override({
initComponent: function () {
this.callParent(arguments);
if (this.vtype == "daterange") {
this.on("keyup", function (item, event) {
var date = item.getValue();
if (Ext.isDate(date)) {
if (item.startDateField) {
Ext.getCmp(item.startDateField).setMaxValue(date);
item.dateRangeMax = date;
}
else if (item.endDateField) {
Ext.getCmp(item.endDateField).setMinValue(date);
item.dateRangeMin = date;
}
item.validate();
}
}, this);
}
}
});
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager ScriptMode="Debug" Theme="Crisp" runat="server" />
<ext:Window Width="350" Title="DateRange" Icon="Date" Closable="false" BodyPadding="5" Layout="Anchor" DefaultAnchor="100%" runat="server">
<Items>
<ext:DateField ID="DateField1" Vtype="daterange" FieldLabel="From" EnableKeyEvents="true" runat="server">
<CustomConfig>
<ext:ConfigItem Name="endDateField" Value="DateField2" Mode="Value" />
</CustomConfig>
</ext:DateField>
<ext:DateField ID="DateField2" Vtype="daterange" FieldLabel="To" EnableKeyEvents="true" runat="server">
<CustomConfig>
<ext:ConfigItem Name="startDateField" Value="DateField1" Mode="Value" />
</CustomConfig>
</ext:DateField>
</Items>
</ext:Window>
</form>
</body>
</html>
Thanks in advance.
Last edited by Daniil; Apr 15, 2015 at 5:04 PM.
Reason: [CLOSED] [#786] [3.2.0]