Guest User

Untitled

a guest
Apr 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. <%@ Control Language="vb" AutoEventWireup="false" CodeBehind="login.ascx.vb" Inherits="Praktikum1.login" %>
  2. <%--Harus ditaruh sebelum control validate, kaya js biasa--%>
  3. <script type="text/javascript">
  4. function validateEmptyUsername(oSrc, args) {
  5. args.IsValid = (args.Value.length > 0);
  6. if (!args.IsValid) {
  7. $("#<%=TextBox1.ClientID%>").addClass("is-invalid");
  8. }
  9. else {
  10. // JQ ga bakalan perlu check, kalau ada disana dia
  11. $("#<%=TextBox1.ClientID%>").removeClass("is-invalid");
  12. }
  13. }
  14.  
  15. function validateEmptyPassword(oSrc, args) {
  16. args.IsValid = (args.Value.length > 0);
  17. if (!args.IsValid) {
  18. $("#<%=TextBox2.ClientID%>").addClass("is-invalid");
  19. }
  20. else {
  21. // JQ ga bakalan perlu check, kalau ada disana dia
  22. $("#<%=TextBox2.ClientID%>").removeClass("is-invalid");
  23. }
  24. }
  25. </script>
  26. <div class="form-group">
  27. <label for="TextBox1">Username / Email</label>
  28. <asp:TextBox ID="TextBox1" runat="server" CssClass="form-control" Width="210px"></asp:TextBox>
  29. <div class="invalid-feedback">
  30. <asp:CustomValidator ID="CustomValidator1"
  31. runat="server"
  32. ErrorMessage="Username atau password kosong!"
  33. ClientValidationFunction="validateEmptyUsername" ControlToValidate="TextBox1" ValidateEmptyText="True"
  34. ></asp:CustomValidator>
  35. </div>
  36. </div>
  37. <div class="form-group">
  38. <label for="TextBox2">Password</label>
  39. <asp:TextBox ID="TextBox2" runat="server" CssClass="form-control" Width="210px"
  40. TextMode="Password"></asp:TextBox>
  41. <div class="invalid-feedback">
  42. <asp:CustomValidator ID="CustomValidator2"
  43. runat="server"
  44. ErrorMessage="Password kosong!"
  45. ClientValidationFunction="validateEmptyPassword" ControlToValidate="TextBox1" ValidateEmptyText="True"
  46. ></asp:CustomValidator>
  47. </div>
  48. </div>
  49.  
  50. <asp:Button ID="Button1" CssClass="btn btn-primary" runat="server" Text="Login" />
Add Comment
Please, Sign In to add comment