Changed around line 1
+ // Handle consultation form submission
+ document.getElementById('consultationForm').addEventListener('submit', function(e) {
+ e.preventDefault();
+
+ const formData = new FormData(this);
+ const imageFile = formData.get('image');
+
+ // Basic validation
+ if (!formData.get('name') || !formData.get('email') || !formData.get('symptoms')) {
+ alert('Please fill in all required fields');
+ return;
+ }
+
+ // Process form data (this would be sent to server in real app)
+ console.log('Consultation submitted:', {
+ name: formData.get('name'),
+ email: formData.get('email'),
+ symptoms: formData.get('symptoms'),
+ image: imageFile ? imageFile.name : 'No image'
+ });
+
+ alert('Your consultation has been submitted successfully!');
+ this.reset();
+ });
+
+ // Handle comment submission
+ document.getElementById('commentForm').addEventListener('submit', function(e) {
+ e.preventDefault();
+
+ const commentText = document.getElementById('comment').value.trim();
+
+ if (!commentText) {
+ alert('Please enter a comment');
+ return;
+ }
+
+ // Create new comment element
+ const commentDiv = document.createElement('div');
+ commentDiv.className = 'comment';
+ commentDiv.textContent = commentText;
+
+ // Add to comments container
+ document.getElementById('commentsContainer').prepend(commentDiv);
+
+ // Clear input
+ document.getElementById('comment').value = '';
+ });
+
+ // Basic image preview (optional enhancement)
+ document.getElementById('image').addEventListener('change', function(e) {
+ const file = e.target.files[0];
+ if (file) {
+ const reader = new FileReader();
+ reader.onload = function(e) {
+ // Could display preview here if desired
+ };
+ reader.readAsDataURL(file);
+ }
+ });
Patient Comments
\nLeave a Comment
\n \n