Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

7.0 KB
Raw Blame
<main
  class="flex flex-col h-full w-full p-6 overflow-auto"
  role="main"
  aria-label="Form submission interface"
>
  <div class="max-w-2xl mx-auto w-full">
    <h1 class="text-2xl font-bold text-gray-900 mb-6">Contact Form</h1>

    <form id="contact-form" class="space-y-4" aria-label="Contact information form">
      <!-- Name Field -->
      <div class="flex flex-col gap-1">
        <label for="name" class="text-sm font-medium text-gray-700">
          Name <span class="text-red-500">*</span>
        </label>
        <input
          type="text"
          id="name"
          name="name"
          class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500"
          placeholder="Enter your full name"
          aria-required="true"
          required
        />
      </div>

      <!-- Email Field -->
      <div class="flex flex-col gap-1">
        <label for="email" class="text-sm font-medium text-gray-700">
          Email <span class="text-red-500">*</span>
        </label>
        <input
          type="email"
          id="email"
          name="email"
          class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500"
          placeholder="[email protected]"
          aria-required="true"
          required
        />
      </div>

      <!-- Age Field -->
      <div class="flex flex-col gap-1">
        <label for="age" class="text-sm font-medium text-gray-700">
          Age <span class="text-red-500">*</span>
        </label>
        <input
          type="number"
          id="age"
          name="age"
          class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500"
          placeholder="Enter your age"
          min="1"
          max="120"
          aria-required="true"
          required
        />
      </div>

      <!-- Country Dropdown -->
      <div class="flex flex-col gap-1">
        <label for="country" class="text-sm font-medium text-gray-700">
          Country <span class="text-red-500">*</span>
        </label>
        <select
          id="country"
          name="country"
          class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white"
          aria-required="true"
          required
        >
          <option value="">Select a country</option>
          <option value="USA">USA</option>
          <option value="Canada">Canada</option>
          <option value="UK">UK</option>
          <option value="Australia">Australia</option>
          <option value="Germany">Germany</option>
          <option value="France">France</option>
          <option value="Japan">Japan</option>
          <option value="Other">Other</option>
        </select>
      </div>

      <!-- Gender Radio Buttons -->
      <div class="flex flex-col gap-2">
        <label class="text-sm font-medium text-gray-700">
          Gender <span class="text-red-500">*</span>
        </label>
        <div class="flex gap-4">
          <label class="flex items-center gap-2 cursor-pointer">
            <input
              type="radio"
              name="gender"
              value="male"
              class="w-4 h-4 text-blue-600"
              aria-label="Male"
            />
            <span class="text-sm text-gray-700">Male</span>
          </label>
          <label class="flex items-center gap-2 cursor-pointer">
            <input
              type="radio"
              name="gender"
              value="female"
              class="w-4 h-4 text-blue-600"
              aria-label="Female"
            />
            <span class="text-sm text-gray-700">Female</span>
          </label>
          <label class="flex items-center gap-2 cursor-pointer">
            <input
              type="radio"
              name="gender"
              value="other"
              class="w-4 h-4 text-blue-600"
              aria-label="Other"
            />
            <span class="text-sm text-gray-700">Other</span>
          </label>
        </div>
      </div>

      <!-- Subscribe Checkbox -->
      <div class="flex items-center gap-2">
        <input
          type="checkbox"
          id="subscribe"
          name="subscribe"
          class="w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500"
          aria-label="Subscribe to newsletter"
        />
        <label for="subscribe" class="text-sm text-gray-700 cursor-pointer">
          Subscribe to newsletter
        </label>
      </div>

      <!-- Comments Textarea -->
      <div class="flex flex-col gap-1">
        <label for="comments" class="text-sm font-medium text-gray-700"> Comments </label>
        <textarea
          id="comments"
          name="comments"
          rows="4"
          class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"
          placeholder="Enter any additional comments..."
          aria-label="Additional comments"
        ></textarea>
      </div>

      <!-- Submit Button -->
      <div class="pt-2">
        <button
          type="submit"
          id="submit-btn"
          class="w-full px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors"
          aria-label="Submit form"
        >
          Submit Form
        </button>
      </div>
    </form>

    <!-- Success Message (hidden by default) -->
    <div id="success-message" class="hidden mt-6 p-4 bg-green-100 border border-green-400 rounded">
      <div class="flex items-center gap-2">
        <iconify-icon
          icon="mdi:check-circle"
          class="text-green-600"
          style="font-size: 1.5rem"
        ></iconify-icon>
        <p class="text-green-800 font-medium">Form submitted successfully!</p>
      </div>
    </div>
  </div>

  <script>
    // Store form data globally for evaluation
    window.__formData = null;

    // Handle form submission
    document.getElementById('contact-form').addEventListener('submit', function (e) {
      e.preventDefault();

      // Get form data
      const formData = new FormData(this);

      // Convert to object and store globally
      window.__formData = {
        name: formData.get('name'),
        email: formData.get('email'),
        age: formData.get('age'),
        country: formData.get('country'),
        gender: formData.get('gender'),
        subscribe: formData.get('subscribe') === 'on',
        comments: formData.get('comments') || '',
      };

      // Disable form
      const formElements = this.querySelectorAll('input, select, textarea, button');
      formElements.forEach((el) => (el.disabled = true));

      // Show success message
      document.getElementById('success-message').classList.remove('hidden');

      // Update button appearance
      const submitBtn = document.getElementById('submit-btn');
      submitBtn.textContent = 'Submitted!';
      submitBtn.classList.remove('bg-blue-600', 'hover:bg-blue-700');
      submitBtn.classList.add('bg-green-600', 'cursor-not-allowed');
    });
  </script>
</main>