Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Register</title>
- <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
- </head>
- <body>
- <div class="container">
- <div class="position-absolute top-50 start-50 translate-middle w-50 shadow p-3">
- <form action="/user/edit/{{ $user->id }}" method="post">
- @csrf
- <h2 class="text-center">Edit data user</h2>
- <div class="mb-3">
- <label for="name">Nama</label>
- <input class="form-control col" type="text" id="name" value="{{$user->name}}" name="name">
- </div>
- <div class="mb-3">
- <label for="email">Email</label>
- <input class="form-control col" type="email" id="email" value="{{$user->email}}" name="email">
- </div>
- <div class="mb-3">
- <fieldset class="border border-warning p-3">
- <legend>Isi jika ingin ubah password</legend>
- <div class="mb-3">
- <label for="password">Password Baru</label>
- <input class="form-control col" type="password" id="password" placeholder="Masukkan password" onkeyup=validatePassword() name="password">
- </div>
- <div class="mb-3">
- <label for="password2">Konfirmasi Password Baru</label>
- <input class="form-control col" type="password" id="password2" placeholder="Masukkan ulang password" onkeyup=validatePassword() name="password2">
- </div>
- </fieldset>
- </div>
- <div class="mb-3">
- <a href="{{ url()->previous() }}" class="btn btn-secondary">Batal</a>
- <input class="btn btn-primary" type="submit" id="submitForm" value="Simpan">
- </div>
- </form>
- </div>
- </div>
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
- <script>
- const password1 = document.getElementById('password')
- const password2 = document.getElementById('password2')
- const submitButton = document.getElementById('submitForm')
- console.log(submitButton)
- function validatePassword(){
- if(password1.value !== password2.value){
- submitButton.disabled = true
- } else {
- submitButton.disabled = false
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment