PDA

View Full Version : [CLOSED] DateField : Validation Not Working



matrixwebtech
Apr 08, 2015, 6:45 PM
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script>
var onKeyUp = function () {

var me = this,
v = me.getValue(),
field;

if (me.startDateField) {
field = Ext.getCmp(me.startDateField);
field.setMaxValue(v);
me.dateRangeMax = v;
} else if (me.endDateField) {
field = Ext.getCmp(me.endDateField);
field.setMinValue(v);
me.dateRangeMin = v;
}

field.validate();
};
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<ext:DateField runat="server" ID="txtdateFrom" FieldLabel="From" LabelAlign="Left" LabelWidth="40" Vtype="daterange" EnableKeyEvents="true" Format="dd-MM-yyyy" AllowBlank="false">
<Listeners>
<%--<AfterRender Handler="this.setValue(getInformationfromuserinfoCookies()[0])"></AfterRender>--%>
<KeyUp Fn="onKeyUp"></KeyUp>
</Listeners>
<CustomConfig>
<ext:ConfigItem Name="endDateField" Value="#{txtdateTo}" Mode="Raw"></ext:ConfigItem>
</CustomConfig>
</ext:DateField>


<ext:DisplayField runat="server" Html="&nbsp;" PaddingSpec="0 0 0 10"></ext:DisplayField>
<ext:DateField runat="server" ID="txtdateTo" FieldLabel="To" LabelAlign="Left" LabelWidth="40" Vtype="daterange" EnableKeyEvents="true" Format="dd-MM-yyyy" AllowBlank="false">
<Listeners>
<%--<AfterRender Handler="this.setValue(getInformationfromuserinfoCookies()[1])"></AfterRender>
<KeyUp Fn="onKeyUp"></KeyUp>--%>
</Listeners>
</ext:DateField>

</asp:Content>

with above code date range validation not working .not found any java script error .please help.

Daniil
Apr 08, 2015, 9:00 PM
Hi @matrixwebtech,

Please follow:
http://forums.ext.net/showthread.php?25464&p=112357&viewfull=1#post112357

matrixwebtech
Apr 09, 2015, 3:31 AM
Thanks ,problem solved.it will be nice if you put some light and explain whats going wrong and what is special in

<ext:ConfigItem
Name="endDateField"
Value="<%# DateField2.ConfigID %>"
Mode="Value"
AutoDataBind="true" />

Daniil
Apr 09, 2015, 9:16 AM
This post explains the problem.

#{ControlID} renders Namespace.ConfigId.
<%# DateField2.ConfigID %> renders only ConfigId.

VType="daterange" retrieves a component via Ext.getCmp(). It fails with Namespace.ConfigId.

matrixwebtech
Apr 09, 2015, 9:22 AM
Thanks ,Please close the thread.