//TIME VALIDATION
function TimeValidation(sender, args) {
var date = ('<%= (System.DateTime.Now).ToString()%>');
var F1, F2, M1, M2;
var TimeIn = $('#<%= txtTimeIn1.ClientID %>').val();
var TimeOut = $('#<%= txtTimeOut1.ClientID %>').val();
if ((TimeIn == "") && (TimeOut == "")) {
return args.IsValid = true;
}
var Time1 = TimeIn.split(":");
var Time2 = TimeOut.split(":");
F1 = Time1[0];
M1 = Time1[1];
F2 = Time2[0];
M2 = Time2[1];
if (TimeIn != "") {
var Min1 = M1.split(" ");
if ((F1 > 12) || (Min1[0] >= 60)) {
$('#<%= CustomTime.ClientID %>').text("Please enter valid Time in");
return args.IsValid = false;
}
}
if (TimeOut != "") {
var Min2 = M2.split(" ");
if ((F2 > 12) || (Min2[0] >= 60)) {
$('#<%= CustomTime.ClientID %>').text("Please enter valid Time out");
return args.IsValid = false;
}
}
if (((TimeIn == "00:00 AM") || (TimeIn == "00:00 PM") || (TimeIn == "")) && (TimeOut != "")) {
$('#<%= CustomTime.ClientID %>').text("Please enter valid Time out");
return args.IsValid = false;
}
if (((TimeOut == "00:00 AM") || (TimeOut == "00:00 PM") || (TimeOut == "")) && (TimeIn != "")) {
$('#<%= CustomTime.ClientID %>').text("Please enter valid Time out");
return args.IsValid = false;
}
if ((TimeIn != "") && (TimeOut != "")) {
var splitdate = date.split(" ");
var jdt1 = Date.parse(splitdate[0] + ' ' + $('#<%= txtTimeIn1.ClientID %>').val());
var jdt2 = Date.parse(splitdate[0] + ' ' + $('#<%= txtTimeOut1.ClientID %>').val());
if (jdt1 >= jdt2) {
$('#<%= CustomTime.ClientID %>').text("Time out should be greater than Time in");
return args.IsValid = false;
}
}
else {
$('#<%= CustomTime.ClientID %>').text("");
return args.IsValid = true;
}
}
//TimeValidation1
function TimeValidation1(sender, args) {
var date = ('<%= (System.DateTime.Now).ToString()%>');
var F1, F2, M1, M2;
var TimeIn2 = $('#<%= txtTimeIn2.ClientID %>').val();
var TimeOut2 = $('#<%= txtTimeOut2.ClientID %>').val();
if ((TimeIn2 == "") && (TimeOut2 == "")) {
return args.IsValid = true;
}
var Time1 = TimeIn2.split(":");
var Time2 = TimeOut2.split(":");
F1 = Time1[0];
M1 = Time1[1];
F2 = Time2[0];
M2 = Time2[1];
if (TimeIn2 != "") {
var Min1 = M1.split(" ");
if ((F1 > 12) || (Min1[0] >= 60)) {
$('#<%= CustomTime1.ClientID %>').text("Please enter valid Time in");
return args.IsValid = false;
}
}
if (TimeOut2 != "") {
var Min2 = M2.split(" ");
if ((F2 > 12) || (Min2[0] >= 60)) {
$('#<%= CustomTime1.ClientID %>').text("Please enter valid Time out");
return args.IsValid = false;
}
}
if (((TimeIn2 == "00:00 AM") || (TimeIn2 == "00:00 PM") || (TimeIn2 == "")) && (TimeOut2 != "")) {
$('#<%= CustomTime1.ClientID %>').text("Please enter valid Time in");
return args.IsValid = false;
}
if (((TimeOut2 == "00:00 AM") || (TimeOut2 == "00:00 PM") || (TimeOut2 == "")) && (TimeIn2 != "")) {
$('#<%= CustomTime1.ClientID %>').text("Please enter valid Time out");
return args.IsValid = false;
}
if ((TimeIn2 != "") && (TimeOut2 != "")) {
var splitdate = date.split(" ");
var jdt1 = Date.parse(splitdate[0] + ' ' + $('#<%= txtTimeIn2.ClientID %>').val());
var jdt2 = Date.parse(splitdate[0] + ' ' + $('#<%= txtTimeOut2.ClientID %>').val());
if (jdt1 >= jdt2) {
$('#<%= CustomTime1.ClientID %>').text("Time out shoud be greater than Time in");
return args.IsValid = false;
}
}
else {
$('#<%= CustomTime1.ClientID %>').text("");
return args.IsValid = true;
}
}
<asp:TextBox ID="txtTimeIn2" TabIndex="5" Width="60px" CssClass="special_text_brown"
runat="server"> </asp:TextBox>
<cc1:MaskedEditExtender ID="mskEditExtTimeIn2" runat="server" MaskType="Time" UserTimeFormat="None"
TargetControlID="txtTimeIn2" Mask="99:99" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError" InputDirection="LeftToRight" AutoComplete="true"
ErrorTooltipEnabled="True" AcceptAMPM="true">
</cc1:MaskedEditExtender>
<asp:CustomValidator ID="CustomTime1" runat="server" SetFocusOnError="true" ClientValidationFunction="TimeValidation1" Display="Dynamic" ></asp:CustomValidator>
function TimeValidation(sender, args) {
var date = ('<%= (System.DateTime.Now).ToString()%>');
var F1, F2, M1, M2;
var TimeIn = $('#<%= txtTimeIn1.ClientID %>').val();
var TimeOut = $('#<%= txtTimeOut1.ClientID %>').val();
if ((TimeIn == "") && (TimeOut == "")) {
return args.IsValid = true;
}
var Time1 = TimeIn.split(":");
var Time2 = TimeOut.split(":");
F1 = Time1[0];
M1 = Time1[1];
F2 = Time2[0];
M2 = Time2[1];
if (TimeIn != "") {
var Min1 = M1.split(" ");
if ((F1 > 12) || (Min1[0] >= 60)) {
$('#<%= CustomTime.ClientID %>').text("Please enter valid Time in");
return args.IsValid = false;
}
}
if (TimeOut != "") {
var Min2 = M2.split(" ");
if ((F2 > 12) || (Min2[0] >= 60)) {
$('#<%= CustomTime.ClientID %>').text("Please enter valid Time out");
return args.IsValid = false;
}
}
if (((TimeIn == "00:00 AM") || (TimeIn == "00:00 PM") || (TimeIn == "")) && (TimeOut != "")) {
$('#<%= CustomTime.ClientID %>').text("Please enter valid Time out");
return args.IsValid = false;
}
if (((TimeOut == "00:00 AM") || (TimeOut == "00:00 PM") || (TimeOut == "")) && (TimeIn != "")) {
$('#<%= CustomTime.ClientID %>').text("Please enter valid Time out");
return args.IsValid = false;
}
if ((TimeIn != "") && (TimeOut != "")) {
var splitdate = date.split(" ");
var jdt1 = Date.parse(splitdate[0] + ' ' + $('#<%= txtTimeIn1.ClientID %>').val());
var jdt2 = Date.parse(splitdate[0] + ' ' + $('#<%= txtTimeOut1.ClientID %>').val());
if (jdt1 >= jdt2) {
$('#<%= CustomTime.ClientID %>').text("Time out should be greater than Time in");
return args.IsValid = false;
}
}
else {
$('#<%= CustomTime.ClientID %>').text("");
return args.IsValid = true;
}
}
//TimeValidation1
function TimeValidation1(sender, args) {
var date = ('<%= (System.DateTime.Now).ToString()%>');
var F1, F2, M1, M2;
var TimeIn2 = $('#<%= txtTimeIn2.ClientID %>').val();
var TimeOut2 = $('#<%= txtTimeOut2.ClientID %>').val();
if ((TimeIn2 == "") && (TimeOut2 == "")) {
return args.IsValid = true;
}
var Time1 = TimeIn2.split(":");
var Time2 = TimeOut2.split(":");
F1 = Time1[0];
M1 = Time1[1];
F2 = Time2[0];
M2 = Time2[1];
if (TimeIn2 != "") {
var Min1 = M1.split(" ");
if ((F1 > 12) || (Min1[0] >= 60)) {
$('#<%= CustomTime1.ClientID %>').text("Please enter valid Time in");
return args.IsValid = false;
}
}
if (TimeOut2 != "") {
var Min2 = M2.split(" ");
if ((F2 > 12) || (Min2[0] >= 60)) {
$('#<%= CustomTime1.ClientID %>').text("Please enter valid Time out");
return args.IsValid = false;
}
}
if (((TimeIn2 == "00:00 AM") || (TimeIn2 == "00:00 PM") || (TimeIn2 == "")) && (TimeOut2 != "")) {
$('#<%= CustomTime1.ClientID %>').text("Please enter valid Time in");
return args.IsValid = false;
}
if (((TimeOut2 == "00:00 AM") || (TimeOut2 == "00:00 PM") || (TimeOut2 == "")) && (TimeIn2 != "")) {
$('#<%= CustomTime1.ClientID %>').text("Please enter valid Time out");
return args.IsValid = false;
}
if ((TimeIn2 != "") && (TimeOut2 != "")) {
var splitdate = date.split(" ");
var jdt1 = Date.parse(splitdate[0] + ' ' + $('#<%= txtTimeIn2.ClientID %>').val());
var jdt2 = Date.parse(splitdate[0] + ' ' + $('#<%= txtTimeOut2.ClientID %>').val());
if (jdt1 >= jdt2) {
$('#<%= CustomTime1.ClientID %>').text("Time out shoud be greater than Time in");
return args.IsValid = false;
}
}
else {
$('#<%= CustomTime1.ClientID %>').text("");
return args.IsValid = true;
}
}
<asp:TextBox ID="txtTimeIn2" TabIndex="5" Width="60px" CssClass="special_text_brown"
runat="server"> </asp:TextBox>
<cc1:MaskedEditExtender ID="mskEditExtTimeIn2" runat="server" MaskType="Time" UserTimeFormat="None"
TargetControlID="txtTimeIn2" Mask="99:99" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError" InputDirection="LeftToRight" AutoComplete="true"
ErrorTooltipEnabled="True" AcceptAMPM="true">
</cc1:MaskedEditExtender>
<asp:CustomValidator ID="CustomTime1" runat="server" SetFocusOnError="true" ClientValidationFunction="TimeValidation1" Display="Dynamic" ></asp:CustomValidator>
No comments:
Post a Comment