Aug 14, 2015, 8:39 PM
[CLOSED] Set two datefields at once
Hello,
I have an event scheduling form with two ext:datefields, txtStartDate and txtEndDate.
I want to set both fields to the same date when the date is changed in the txtStartDate control. I have already tried the OnTextChanged event - but it doesn't fire.
I have an event scheduling form with two ext:datefields, txtStartDate and txtEndDate.
I want to set both fields to the same date when the date is changed in the txtStartDate control. I have already tried the OnTextChanged event - but it doesn't fire.
<script type="text/javascript">
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();
}
};
</script>
<script>
protected void txtStartDate_OnTextChanged(object sender, EventArgs e) {
string myStartDate = txtStartDate.Text;
txtEndDate.Text = myStartDate;
}
</script>
<ext:DateField ID="txtStartDate" runat="server" Vtype="daterange" EnableKeyEvents="true" DisabledCls="noBorder"
Width="95" Format="MM/dd/yyyy" AllowBlank="false" StyleSpec="font-size:10pt; font-weight:bold;" OnTextChanged="txtStartDate_OnTextChanged" >
<CustomConfig>
<ext:ConfigItem Name="endDateField" Value="txtEndDate" Mode="Value" />
</CustomConfig>
<Listeners>
<KeyUp Fn="onKeyUp" />
</Listeners>
</ext:DateField>
<ext:DateField ID="txtEndDate" runat="server" Vtype="daterange" EnableKeyEvents="true" DisabledCls="noBorder"
Width="95" Format="MM/dd/yyyy" AllowBlank="false" StyleSpec="font-size:10pt; font-weight:bold;" >
<CustomConfig>
<ext:ConfigItem Name="startDateField" Value="txtStartDate" Mode="Value" />
</CustomConfig>
<Listeners>
<KeyUp Fn="onKeyUp" />
</Listeners>
</ext:DateField>
Last edited by Daniil; Aug 26, 2015 at 7:27 AM.
Reason: [CLOSED]