Hi there,
I have the following scenario:
arrival and departure dates have to be selected on a form, through 2 textboxes with a calendar extender each.
I validate the entries to check that no date before today is selected and to check that the departure is after the arrival. I used a rangevalidator and a comparevalidator.
In IE, Firefox and Opera it is working fine, in Safari (on windows) however both the validators go off even on entries that should be accepted.
It makes me suspect that the date format dd/MM/yyyy causes trouble for Safari.
(the dd/MMMM/yyyy also gave the same troubles in the other browsers, probably due to the dependency on UIculture)
The code is:
<tr>
<td>
<asp:TextBox ID="txtArrive" runat="server"></asp:TextBox>
<cc1:TextBoxWatermarkExtender ID="txtArriveWatermarkExt" runat="server"
Enabled="True" TargetControlID="txtArrive" WatermarkText="arrival date">
</cc1:TextBoxWatermarkExtender>
<cc1:CalendarExtender ID="ArriveCalendarExt" runat="server"
CssClass="MyCalendar" Enabled="True" Format="dd/MM/yyyy"
TargetControlID="txtArrive">
</cc1:CalendarExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtArrive" ErrorMessage="please select arrival date"
Text="*" ValidationGroup="date" Display="none"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ErrorMessage="please make sure that your arrival date is later than today and not later than a year from now"
ControlToValidate="txtArrive" Type="Date" ValidationGroup="date" Text="*"></asp:RangeValidator>
</td>
<td>
<asp:TextBox ID="txtDepart" runat="server"></asp:TextBox>
<cc1:TextBoxWatermarkExtender ID="txtDepartWatermarkExt" runat="server"
Enabled="True" TargetControlID="txtDepart" WatermarkText="departure date">
</cc1:TextBoxWatermarkExtender>
<cc1:CalendarExtender ID="DepartCalendarExt" CssClass="MyCalendar" runat="server" Enabled="True"
Format="dd/MM/yyyy" TargetControlID="txtDepart">
</cc1:CalendarExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtDepart" ErrorMessage="Please select departure date"
Text="*" ValidationGroup="date"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator2" runat="server"
ControlToCompare="txtDepart" ControlToValidate="txtArrive"
ErrorMessage="your departure date has to be later than your arrival date"
Operator="LessThan" Type="Date" Text="*" ValidationGroup="date"></asp:CompareValidator>
</td>
<td>
</td>
</tr>
The range validator gets its values in code behind on Page_load
RangeValidator1.MinimumValue = DateTime.Now.AddDays(1).ToShortDateString(); RangeValidator1.MaximumValue = DateTime.Now.AddMonths(12).ToShortDateString();
Does anybody have any suggestions on how to solve this problem with safari?
best regards, Robin