~cytrogen/gstack

ref: ae0a9ad1958ca75256568f57dcae7163c7d42050 gstack/browse/test/fixtures/forms.html -rw-r--r-- 1.8 KiB
ae0a9ad1 — Garry Tan feat: GStack Learns — per-project self-learning infrastructure (v0.13.4.0) (#622) 12 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Test Page - Forms</title>
  <style>
    body { font-family: sans-serif; padding: 20px; }
    form { margin-bottom: 20px; padding: 10px; border: 1px solid #ccc; }
    label { display: block; margin: 5px 0; }
    input, select, textarea { margin-bottom: 10px; padding: 5px; }
    #result { color: green; display: none; }
  </style>
</head>
<body>
  <h1>Form Test Page</h1>

  <form id="login-form" action="/login" method="post">
    <label for="email">Email:</label>
    <input type="email" id="email" name="email" placeholder="your@email.com" required>
    <label for="password">Password:</label>
    <input type="password" id="password" name="password" required>
    <button type="submit" id="login-btn">Log In</button>
  </form>

  <form id="profile-form" action="/profile" method="post">
    <label for="name">Name:</label>
    <input type="text" id="name" name="name" placeholder="Your name">
    <label for="bio">Bio:</label>
    <textarea id="bio" name="bio" placeholder="Tell us about yourself"></textarea>
    <label for="role">Role:</label>
    <select id="role" name="role">
      <option value="">Choose...</option>
      <option value="admin">Admin</option>
      <option value="user">User</option>
      <option value="guest">Guest</option>
    </select>
    <label>
      <input type="checkbox" id="newsletter" name="newsletter"> Subscribe to newsletter
    </label>
    <button type="submit" id="profile-btn">Save Profile</button>
  </form>

  <div id="result">Form submitted!</div>

  <script>
    document.querySelectorAll('form').forEach(form => {
      form.addEventListener('submit', (e) => {
        e.preventDefault();
        document.getElementById('result').style.display = 'block';
        console.log('[Form] Submitted:', form.id);
      });
    });
  </script>
</body>
</html>