mnaufaldillah

Form Tugas 6 PWEB A

Oct 10th, 2021
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 4.62 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.     <head>
  4.         <title>Form Persetujuan Kuliah Offline</title>
  5.         <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
  6.         <script type="text/javascript" src="main.js"></script>
  7.         <script>
  8.             function validateForm() {
  9.                 var email = document.forms["ptm"]["email"];
  10.                 atposition = email.value.atposition("@");
  11.                 dotpositon = email.value.lastIndexOf(".");
  12.  
  13.                 function notify() {
  14.                     alert("Terima Kasih telah mengisi formulir persetujuan kuliah offline.");
  15.                 }
  16.  
  17.                 if (document.forms["ptm"]["nama"].value == "") {
  18.                     alert("Mohon Isi Nama Anda.");
  19.                     document.forms["ptm"]["nama"].focus();
  20.                     return false;
  21.                 }
  22.  
  23.                 if (document.forms["ptm"]["nrp"].value == "") {
  24.                     alert("Mohon Isi NRP Anda.");
  25.                     document.forms["ptm"]["nrp"].focus();
  26.                     return false;
  27.                 }
  28.  
  29.                 if (document.forms["ptm"]["alamat"].value == "") {
  30.                     alert("Mohon Isi Alamat Anda.");
  31.                     document.forms["ptm"]["alamat"].focus();
  32.                     return false;
  33.                 }
  34.  
  35.                 if (email.value == "" && atposition < 1 || (dotpositon - atposition < 2)) {
  36.                    alert("Mohon Masukkan Email Anda dengan benar");
  37.                     email.focus();
  38.                     return false;
  39.                 }
  40.  
  41.                 if (document.forms["ptm"]["jurusan"].selectedIndex < 1) {
  42.                    alert("Pilih Jurusan Anda");
  43.                    document.forms["ptm"]["jurusan"].focus();
  44.                    return false;
  45.                }
  46.    
  47.                if (document.forms["ptm"]["vaksin"].selectedIndex < 1) {
  48.                    alert("Pilih Status Vaksin Anda");
  49.                    document.forms["ptm"]["vaksin"].focus();
  50.                    return false;
  51.                }
  52.  
  53.                notify();
  54.  
  55.                return true;
  56.            }
  57.        </script>
  58.     </head>
  59.     <body>
  60.         <div class="form-container">
  61.             <div class="formulir">
  62.                 <h1>Formulir Persetujuan Kuliah Offline</h1>
  63.                 <form autocomplete="off" name="ptm" onsubmit="return validateForm();">
  64.                     <div class="form-content">
  65.                         <label>Nama Lengkap</label>
  66.                         <input type="text" name="nama" placeholder="Nama" class="form-control" maxlength="50">
  67.                     </div>
  68.                     <div class="form-content">
  69.                         <label>NRP</label>
  70.                         <input type="text" name="nrp" placeholder="NRP" class="form-control" maxlength="14">
  71.                     </div>
  72.                     <div class="form-content">
  73.                         <label>Alamat</label>
  74.                         <input type="text" name="alamat" placeholder="Alamat" class="form-control">
  75.                     </div>
  76.                     <div class="form-content">
  77.                         <label>Email</label>
  78.                         <input type="text" name="email" placeholder="Email" class="form-control">
  79.                     </div>
  80.                     <div class="form-content">
  81.                         <label>Jurusan</label>
  82.                         <select name="jurusan" class="form-control">
  83.                             <option value="0">Pilih Jurusan</option>
  84.                             <option value="1">Teknik Informatika</option>
  85.                             <option value="2">Sistem Informasi</option>
  86.                             <option value="3">Teknologi Informasi</option>
  87.                             <option value="4">Teknik Komputer</option>
  88.                             <option value="5">Teknik Elektro</option>
  89.                         </select>
  90.                     </div>
  91.                     <div class="form-content">
  92.                         <label>Status Vaksin</label>
  93.                         <select name="vaksin" class="form-control">
  94.                             <option value="0">Status Vaksin</option>
  95.                             <option value="1">Belum Vaksin</option>
  96.                             <option value="2">Vaksin Pertama</option>
  97.                             <option value="3">Vaksin Kedua</option>
  98.                         </select>
  99.                     </div>
  100.                     <button type="submit" class="btn btn-primary">submit</button>
  101.                 </form>
  102.             </div>
  103.         </div>
  104.     </body>
  105. </html>
Advertisement
Add Comment
Please, Sign In to add comment