Validatoren wurden auch auf Kalender übertragen

This commit is contained in:
ja
2021-09-28 09:24:58 +02:00
parent 6b6faa826d
commit 2b57ffee04
3 changed files with 22 additions and 46 deletions

View File

@@ -107,11 +107,11 @@
<div class="col-12" id="cont4"> <div class="col-12" id="cont4">
<div class="col-12" id="container2" style="margin-left:2px"> <div class="col-12" id="container2" style="margin-left:2px">
<asp:Label ID="lbl_von" runat="server" Text="Von:"></asp:Label> <asp:Label ID="lbl_von" runat="server" Text="Von:"></asp:Label>
<asp:TextBox id="pickdate1" Type="Date" ClientValidationFunction="validate" CssClass="classTarget" OnTextChanged="pickdate1_TextChanged" runat="server"></asp:TextBox> <asp:TextBox id="pickdate1" Type="Date" CssClass="classTarget" requiered="true" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidatorvon" runat="server" ErrorMessage="Field required" ControlToValidate="pickdate1" Text="Required" ForeColor="White" Font-Strikeout="False" Font-Underline="False" Font-Overline="False" Font-Bold="True" BackColor="Red"></asp:RequiredFieldValidator> <!--<asp:RequiredFieldValidator ID="RequiredFieldValidatorvon" runat="server" ErrorMessage="Field required" ControlToValidate="pickdate1" Text="Required" ForeColor="White" Font-Strikeout="False" Font-Underline="False" Font-Overline="False" Font-Bold="True" BackColor="Red"></asp:RequiredFieldValidator>
<asp:CustomValidator ValidateEmptyText="false" ClientValidationFunction=""></asp:CustomValidator> <asp:CustomValidator ValidateEmptyText="false" ClientValidationFunction="instantValidation"></asp:CustomValidator> -->
<asp:Label ID="lbl_bis" runat="server" Text="Bis:"></asp:Label> <asp:Label ID="lbl_bis" runat="server" Text="Bis:"></asp:Label>
<asp:RequiredFieldValidator ID="RequiredFieldValidatorbis" ClientValidationFunction="validate" runat="server" ErrorMessage="Field required" ControlToValidate="pickdate2" Text="Required" ForeColor="White" Font-Strikeout="False" Font-Underline="False" Font-Overline="False" Font-Bold="True" BackColor="Red"></asp:RequiredFieldValidator> <!-- <asp:RequiredFieldValidator ID="RequiredFieldValidatorbis" ClientValidationFunction="validate" runat="server" ErrorMessage="Field required" ControlToValidate="pickdate2" Text="Required" ForeColor="White" Font-Strikeout="False" Font-Underline="False" Font-Overline="False" Font-Bold="True" BackColor="Red"></asp:RequiredFieldValidator> -->
<asp:TextBox id="pickdate2" Type="Date" CssClass="classTarget" OnTextChanged="pickdate2_TextChanged" runat="server"></asp:TextBox> <asp:TextBox id="pickdate2" Type="Date" CssClass="classTarget" OnTextChanged="pickdate2_TextChanged" runat="server"></asp:TextBox>
</div> </div>
<div id="Abstand"></div> <div id="Abstand"></div>
@@ -221,34 +221,20 @@
var el = $(ele).closest('label').text(); var el = $(ele).closest('label').text();
if (el == "Alle") { if (el == "Alle") {
$("#container2").show(); $("#container2").show();
$("#pickdate1").text = "01." + Date.now.MM.toString + "." +Date.now.yyyy.toString + " " + Date.now.hh.toString + ":" + Date.now.MM.toString + ":" + Date.now.yyyy.toString; var date1 = document.getElementById('<%=pickdate1.ClientID%>')
$("#pickdate2").text = Date.now.dd.toString + "." + Date.now.MM.toString + "." Date.now.yyyy.toString + " " + Date.now.hh.toString + ":" + Date.now.MM.toString + ":" + Date.now.yyyy.toString; var date2 = document.getElementById('<%=pickdate2.ClientID%>')
ValidatorEnable(document.getElementById('<%=RequiredFieldValidatorvon.ClientID %>'), true); date1.attributes.required = true
ValidatorEnable(document.getElementById('<%=RequiredFieldValidatorbis.ClientID %>'), true); date2.attributes.required = true
dat
} else if (el == "Alle_M") { } else if (el == "Alle_M") {
$("#container2").show(); $("#container2").show();
$("#pickdate1").text = "01." + Date.now.MM.toString + "." + Date.now.yyyy.toString + " " + Date.now.hh.toString + ":" + Date.now.MM.toString + ":" + Date.now.yyyy.toString; date1.attributes.required = true
$("#pickdate2").text = Date.now.dd.toString + "." + Date.now.MM.toString + "." Date.now.yyyy.toString + " " + Date.now.hh.toString + ":" + Date.now.MM.toString + ":" + Date.now.yyyy.toString; date2.attributes.required = true
ValidatorEnable(document.getElementById('<%=RequiredFieldValidatorvon.ClientID %>'), true);
ValidatorEnable(document.getElementById('<%=RequiredFieldValidatorbis.ClientID %>'), true);
} else if (el == "Freigabe") {
$("#container2").show();
$("#pickdate1").text = "01." + Date.now.MM.toString + "." + Date.now.yyyy.toString + " " + Date.now.hh.toString + ":" + Date.now.MM.toString + ":" + Date.now.yyyy.toString;
$("#pickdate2").text = Date.now.dd.toString + "." + Date.now.MM.toString + "." Date.now.yyyy.toString + " " + Date.now.hh.toString + ":" + Date.now.MM.toString + ":" + Date.now.yyyy.toString;
ValidatorEnable(document.getElementById('<%=RequiredFieldValidatorvon.ClientID %>'), true);
ValidatorEnable(document.getElementById('<%=RequiredFieldValidatorbis.ClientID %>'), true);
} else if (el == "Freigabe_M") {
$("#container2").show();
$("#pickdate1").text = "01." + Date.now.MM.toString + "." + Date.now.yyyy.toString + " " + Date.now.hh.toString + ":" + Date.now.MM.toString + ":" + Date.now.yyyy.toString;
$("#pickdate2").text = Date.now.dd.toString + "." + Date.now.MM.toString + "." Date.now.yyyy.toString + " " + Date.now.hh.toString + ":" + Date.now.MM.toString + ":" + Date.now.yyyy.toString;
ValidatorEnable(document.getElementById('<%=RequiredFieldValidatorvon.ClientID %>'), true);
ValidatorEnable(document.getElementById('<%=RequiredFieldValidatorbis.ClientID %>'), true);
} else { } else {
$("#container2").hide(); $("#container2").hide();
$("#pickdate1").text = "01." + Date.now.MM.toString + "." + Date.now.yyyy.toString + " " + Date.now.hh.toString + ":" + Date.now.MM.toString + ":" + Date.now.yyyy.toString; date1.attributes.required = false
$("#pickdate2").text = Date.now.dd.toString + "." + Date.now.MM.toString + "." Date.now.yyyy.toString + " " + Date.now.hh.toString + ":" + Date.now.MM.toString + ":" + Date.now.yyyy.toString; date2.attributes.required = false
ValidatorEnable(document.getElementById('<%=RequiredFieldValidatorvon.ClientID %>'), false);
ValidatorEnable(document.getElementById('<%=RequiredFieldValidatorbis.ClientID %>'), false);
} }
} }
</script> </script>
@@ -261,13 +247,7 @@
} }
}); });
</script> </script>
<script type="text/javascript">
var v1 = Date.parse(document.getElementById("pickdate1").text);
var v2 = Date.parse(document.getElementById("pickdate2").text);
If(compareDate(v1)==false) {
alert("Datum nicht im gültigen Rahmen!");
}
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
function compareDate(str1, str2){ function compareDate(str1, str2){
@@ -282,7 +262,4 @@
} }
}; };
</script> </script>
<script type="text/javascript">
alert(window.frame1.zipphone1_1)
</script>
</asp:Content> </asp:Content>

View File

@@ -427,16 +427,16 @@ Partial Class Kundenbereich_Default
End Sub End Sub
Protected Sub pickdate1_TextChanged(sender As Object, e As EventArgs) Protected Sub pickdate1_TextChanged(sender As Object, e As EventArgs)
Dim TB As TextBox = sender Dim TB As TextBox = pickdate1
If TB.Text = "" Then If TB.Text = "" Then
TB.Attributes.Add("Border", "2px solid red") pickdate1.BorderColor = Drawing.Color.Red
Else Else
TB.Attributes.Add("Border", "None") pickdate1.BorderStyle = 1
End If End If
End Sub End Sub
Protected Sub pickdate2_TextChanged(sender As Object, e As EventArgs) Protected Sub pickdate2_TextChanged(sender As Object, e As EventArgs)
Dim TB As TextBox = sender Dim TB As TextBox = pickdate2
If TB.Text = "" Then If TB.Text = "" Then
TB.Attributes.Add("Border", "2px solid red") TB.Attributes.Add("Border", "2px solid red")
Else Else

View File

@@ -619,7 +619,7 @@
} }
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
$(document.ready(function () { $(document.ready(() {
var x = window.frame1.zipphone1_1; var x = window.frame1.zipphone1_1;
alert(x); alert(x);
var y = window.frame1.zipphone1_2; var y = window.frame1.zipphone1_2;
@@ -632,8 +632,7 @@
alert(y); alert(y);
var z = window.frame1.zipphone2_3; var z = window.frame1.zipphone2_3;
alert(z); alert(z);
}));
});
</script> </script>
</body> </body>
</html> </html>