actimedia commited on
Commit
1b5f37f
·
verified ·
1 Parent(s): a4402c1

en el paso 2, cuando presiono el boton continuar y hay campos vacios, avisar de alguna manera y hacer foco en ese campo a completar

Browse files
Files changed (1) hide show
  1. index.html +53 -12
index.html CHANGED
@@ -32,7 +32,17 @@
32
  display: block;
33
  animation: fadeIn 0.5s ease-in-out;
34
  }
35
- @keyframes fadeIn {
 
 
 
 
 
 
 
 
 
 
36
  from { opacity: 0; transform: translateY(20px); }
37
  to { opacity: 1; transform: translateY(0); }
38
  }
@@ -130,7 +140,7 @@
130
  <div class="bg-blue-50 border-l-4 border-blue-500 p-4 mb-6 rounded">
131
  <div class="flex justify-between items-center">
132
  <div>
133
- <h3 class="font-bold text-blue-800">Dominio seleccionado:</h3>
134
  <p class="text-blue-600" id="selected-domain-display"></p>
135
  </div>
136
  <div class="bg-white px-3 py-1 rounded-full shadow-sm">
@@ -154,18 +164,18 @@
154
  <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
155
  <div>
156
  <label class="block text-gray-700 mb-2" for="full-name">Nombres completos</label>
157
- <input type="text" id="full-name" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary">
158
- </div>
159
  <div>
160
  <label class="block text-gray-700 mb-2" for="id-number">Cédula/RUC</label>
161
- <input type="text" id="id-number" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary">
162
- </div>
163
  </div>
164
 
165
  <div class="mb-6">
166
  <label class="block text-gray-700 mb-2" for="personal-email">Correo personal</label>
167
- <input type="email" id="personal-email" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary">
168
- </div>
169
 
170
  <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
171
  <div>
@@ -475,12 +485,43 @@ document.querySelector('.step-indicator[data-step="2"] span').classList.add('tex
475
  const fullName = document.getElementById('full-name').value;
476
  const idNumber = document.getElementById('id-number').value;
477
  const personalEmail = document.getElementById('personal-email').value;
478
-
479
- if(fullName.trim() === '' || idNumber.trim() === '' || personalEmail.trim() === '') {
480
- alert('Por favor completa todos los campos requeridos');
481
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
482
  }
483
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  // Scroll to top of step 3 before showing it
485
  document.getElementById('step3').scrollIntoView({ behavior: 'smooth', block: 'start' });
486
  // Update confirmation data
 
32
  display: block;
33
  animation: fadeIn 0.5s ease-in-out;
34
  }
35
+ .border-red-500 {
36
+ border-color: #ef4444;
37
+ animation: pulse 0.5s ease-in-out;
38
+ }
39
+ @keyframes pulse {
40
+ 0% { transform: translateX(0); }
41
+ 25% { transform: translateX(-5px); }
42
+ 50% { transform: translateX(5px); }
43
+ 100% { transform: translateX(0); }
44
+ }
45
+ @keyframes fadeIn {
46
  from { opacity: 0; transform: translateY(20px); }
47
  to { opacity: 1; transform: translateY(0); }
48
  }
 
140
  <div class="bg-blue-50 border-l-4 border-blue-500 p-4 mb-6 rounded">
141
  <div class="flex justify-between items-center">
142
  <div>
143
+ <h3 class="font-bold text-blue-800">Dominio reservado. Expira en:</h3>
144
  <p class="text-blue-600" id="selected-domain-display"></p>
145
  </div>
146
  <div class="bg-white px-3 py-1 rounded-full shadow-sm">
 
164
  <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
165
  <div>
166
  <label class="block text-gray-700 mb-2" for="full-name">Nombres completos</label>
167
+ <input type="text" id="full-name" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary transition">
168
+ </div>
169
  <div>
170
  <label class="block text-gray-700 mb-2" for="id-number">Cédula/RUC</label>
171
+ <input type="text" id="id-number" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary transition">
172
+ </div>
173
  </div>
174
 
175
  <div class="mb-6">
176
  <label class="block text-gray-700 mb-2" for="personal-email">Correo personal</label>
177
+ <input type="email" id="personal-email" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary transition">
178
+ </div>
179
 
180
  <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
181
  <div>
 
485
  const fullName = document.getElementById('full-name').value;
486
  const idNumber = document.getElementById('id-number').value;
487
  const personalEmail = document.getElementById('personal-email').value;
488
+ // Validate all required fields
489
+ const requiredFields = [
490
+ { id: 'full-name', name: 'Nombres completos' },
491
+ { id: 'id-number', name: 'Cédula/RUC' },
492
+ { id: 'personal-email', name: 'Correo personal' }
493
+ ];
494
+
495
+ let isValid = true;
496
+ let firstInvalidField = null;
497
+
498
+ for (const field of requiredFields) {
499
+ const element = document.getElementById(field.id);
500
+ if (element.value.trim() === '') {
501
+ if (!firstInvalidField) firstInvalidField = element;
502
+ isValid = false;
503
+ element.classList.add('border-red-500');
504
+ element.scrollIntoView({ behavior: 'smooth', block: 'center' });
505
+ setTimeout(() => {
506
+ element.focus();
507
+ }, 500);
508
+ } else {
509
+ element.classList.remove('border-red-500');
510
+ }
511
  }
512
 
513
+ if (!isValid) {
514
+ const errorMessage = firstInvalidField ?
515
+ `Por favor completa el campo: ${firstInvalidField.previousElementSibling.textContent.trim()}` :
516
+ 'Por favor completa todos los campos requeridos';
517
+ alert(errorMessage);
518
+ return;
519
+ }
520
+ // Reset any error highlights
521
+ document.querySelectorAll('input').forEach(input => {
522
+ input.classList.remove('border-red-500');
523
+ });
524
+
525
  // Scroll to top of step 3 before showing it
526
  document.getElementById('step3').scrollIntoView({ behavior: 'smooth', block: 'start' });
527
  // Update confirmation data