cremote/test-phase3-forms.html

206 lines
7.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Phase 3 Form Testing</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.form-section {
margin: 30px 0;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
.form-group {
margin: 15px 0;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input, select, textarea {
width: 100%;
padding: 8px;
margin-bottom: 10px;
border: 1px solid #ddd;
border-radius: 3px;
}
button {
background-color: #007bff;
color: white;
padding: 10px 20px;
border: none;
border-radius: 3px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
.checkbox-group {
display: flex;
align-items: center;
margin: 10px 0;
}
.checkbox-group input[type="checkbox"] {
width: auto;
margin-right: 10px;
}
.radio-group {
margin: 10px 0;
}
.radio-group input[type="radio"] {
width: auto;
margin-right: 5px;
}
.result {
margin-top: 20px;
padding: 10px;
background-color: #f8f9fa;
border-radius: 3px;
}
</style>
</head>
<body>
<h1>Phase 3 Form Testing</h1>
<div class="form-section">
<h2>User Registration Form</h2>
<form id="registration-form" action="#" method="post">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required placeholder="Enter username">
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required placeholder="Enter email">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password" required placeholder="Enter password">
</div>
<div class="form-group">
<label for="country">Country:</label>
<select id="country" name="country" required>
<option value="">Select Country</option>
<option value="us">United States</option>
<option value="ca">Canada</option>
<option value="uk">United Kingdom</option>
<option value="de">Germany</option>
<option value="fr">France</option>
</select>
</div>
<div class="form-group">
<label for="bio">Bio:</label>
<textarea id="bio" name="bio" rows="4" placeholder="Tell us about yourself"></textarea>
</div>
<div class="checkbox-group">
<input type="checkbox" id="newsletter" name="newsletter" value="yes">
<label for="newsletter">Subscribe to newsletter</label>
</div>
<div class="checkbox-group">
<input type="checkbox" id="terms" name="terms" value="agreed" required>
<label for="terms">I agree to the terms and conditions</label>
</div>
<div class="form-group">
<label>Preferred Contact Method:</label>
<div class="radio-group">
<input type="radio" id="contact-email" name="contact-method" value="email">
<label for="contact-email">Email</label>
</div>
<div class="radio-group">
<input type="radio" id="contact-phone" name="contact-method" value="phone">
<label for="contact-phone">Phone</label>
</div>
<div class="radio-group">
<input type="radio" id="contact-sms" name="contact-method" value="sms">
<label for="contact-sms">SMS</label>
</div>
</div>
<button type="submit" id="register-btn">Register</button>
</form>
</div>
<div class="form-section">
<h2>Quick Contact Form</h2>
<form id="contact-form" action="#" method="post">
<div class="form-group">
<label for="contact-name">Name:</label>
<input type="text" id="contact-name" name="name" required>
</div>
<div class="form-group">
<label for="contact-email">Email:</label>
<input type="email" id="contact-email" name="email" required>
</div>
<div class="form-group">
<label for="message">Message:</label>
<textarea id="message" name="message" rows="3" required></textarea>
</div>
<button type="submit" id="contact-submit">Send Message</button>
</form>
</div>
<div class="form-section">
<h2>Interactive Elements</h2>
<div class="form-group">
<button id="test-button" onclick="showResult('Button clicked!')">Test Button</button>
<button id="toggle-button" onclick="toggleVisibility()">Toggle Visibility</button>
</div>
<div id="hidden-content" style="display: none;">
<p>This content was hidden and is now visible!</p>
<input type="text" id="hidden-input" placeholder="Hidden input field">
</div>
<div class="result" id="result-area">
Results will appear here...
</div>
</div>
<script>
function showResult(message) {
document.getElementById('result-area').textContent = message;
}
function toggleVisibility() {
const hiddenContent = document.getElementById('hidden-content');
if (hiddenContent.style.display === 'none') {
hiddenContent.style.display = 'block';
showResult('Content is now visible');
} else {
hiddenContent.style.display = 'none';
showResult('Content is now hidden');
}
}
// Form submission handlers
document.getElementById('registration-form').addEventListener('submit', function(e) {
e.preventDefault();
showResult('Registration form submitted successfully!');
});
document.getElementById('contact-form').addEventListener('submit', function(e) {
e.preventDefault();
showResult('Contact form submitted successfully!');
});
</script>
</body>
</html>