Created
April 14, 2018 04:09
-
-
Save benyaminl/f97af6cd6791e21673ef40c190fca212 to your computer and use it in GitHub Desktop.
login.ascx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="login.ascx.vb" Inherits="Praktikum1.login" %> | |
<%--Harus ditaruh sebelum control validate, kaya js biasa--%> | |
<script type="text/javascript"> | |
function validateEmptyUsername(oSrc, args) { | |
args.IsValid = (args.Value.length > 0); | |
if (!args.IsValid) { | |
$("#<%=TextBox1.ClientID%>").addClass("is-invalid"); | |
} | |
else { | |
// JQ ga bakalan perlu check, kalau ada disana dia | |
$("#<%=TextBox1.ClientID%>").removeClass("is-invalid"); | |
} | |
} | |
function validateEmptyPassword(oSrc, args) { | |
args.IsValid = (args.Value.length > 0); | |
if (!args.IsValid) { | |
$("#<%=TextBox2.ClientID%>").addClass("is-invalid"); | |
} | |
else { | |
// JQ ga bakalan perlu check, kalau ada disana dia | |
$("#<%=TextBox2.ClientID%>").removeClass("is-invalid"); | |
} | |
} | |
</script> | |
<div class="form-group"> | |
<label for="TextBox1">Username / Email</label> | |
<asp:TextBox ID="TextBox1" runat="server" CssClass="form-control" Width="210px"></asp:TextBox> | |
<div class="invalid-feedback"> | |
<asp:CustomValidator ID="CustomValidator1" | |
runat="server" | |
ErrorMessage="Username atau password kosong!" | |
ClientValidationFunction="validateEmptyUsername" ControlToValidate="TextBox1" ValidateEmptyText="True" | |
></asp:CustomValidator> | |
</div> | |
</div> | |
<div class="form-group"> | |
<label for="TextBox2">Password</label> | |
<asp:TextBox ID="TextBox2" runat="server" CssClass="form-control" Width="210px" | |
TextMode="Password"></asp:TextBox> | |
<div class="invalid-feedback"> | |
<asp:CustomValidator ID="CustomValidator2" | |
runat="server" | |
ErrorMessage="Password kosong!" | |
ClientValidationFunction="validateEmptyPassword" ControlToValidate="TextBox1" ValidateEmptyText="True" | |
></asp:CustomValidator> | |
</div> | |
</div> | |
<asp:Button ID="Button1" CssClass="btn btn-primary" runat="server" Text="Login" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment