document.getElementById('evaluationForm').addEventListener('submit', function(e) { e.preventDefault(); // Collect all form data const formData = { personalInfo: { firstName: document.getElementById('firstName').value, lastName: document.getElementById('lastName').value, birthYear: document.getElementById('birthYear').value, nationalId: document.getElementById('nationalId').value }, physicalInfo: { height: document.getElementById('height').value, weight: document.getElementById('weight').value }, // ... collect other form data similarly }; // Calculate score (this would be done server-side in a real app) let score = 0; // Height score const height = parseInt(formData.physicalInfo.height); if (height >= 175 && height < 185) score += 3; else if (height >= 185 && height < 195) score += 6; else if (height >= 195) score += 10; // BMI score (sample calculation) const weight = parseInt(formData.physicalInfo.weight); if (height && weight) { const bmi = weight / Math.pow(height/100, 2); if (bmi >= 16 && bmi < 18.5) score += 5; else if (bmi >= 18.5 && bmi < 25) score += 10; else if (bmi >= 25 && bmi < 30) score += 5; else if (bmi >= 35 && bmi < 40) score += 3; } // Add other score calculations here... // In a real app, you would send this to the server console.log('Form data:', formData); console.log('Calculated score:', score); // Show success message alert('اطلاعات با موفقیت ثبت شد. امتیاز شما محاسبه و به مدیر سیستم ارسال گردید.'); // Reset form this.reset(); });