Skip to content

Commit

Permalink
Checkbox validation for question2
Browse files Browse the repository at this point in the history
  • Loading branch information
Brijeshthummar02 committed Oct 12, 2024
1 parent 0ae30f2 commit 80d9256
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion services/report_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def build_prompt(self, industry: str, answer: List[str],
As an AI consultant specializing in business and entrepreneurship, your task is to develop a strategic operational plan for integrating artificial intelligence into the user's business operations within the {industry} industry.
### Business Overview:
- **Objectives**: The primary objectives for AI integration are to {answer[0]}.
- **Objectives**: The primary objectives for AI integration are to {', '.join(answer[0])}.
- **Current Technology and Data**: The business currently uses {answer[1]}, and AI will need to integrate with these existing systems and data.
- **Workforce and Training Needs**: The team’s skill level is currently at {answer[2]}, and they will require training to effectively use AI.
Expand Down
15 changes: 14 additions & 1 deletion static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ document.addEventListener('DOMContentLoaded', function() {
'Email': formData.get('client_email'),
'Business Industry': formData.get('industry'),
'What are your current data management and utilization challenges?': formData.get('question1'),
'What are the areas of technology integration and inefficiency?': formData.get('question2'),
'What are the areas of technology integration and inefficiency?': formData.getAll('question2').join(', '),
'What are your long-term business goals and AI\'s role in achieving them?': formData.get('question3'),
};

Expand All @@ -57,6 +57,7 @@ document.addEventListener('DOMContentLoaded', function() {
const currentFields = steps[currentStep].querySelectorAll('input, textarea, select');
let isValid = true;

// Validate text inputs, textareas, and select fields
for (const field of currentFields) {
if (!field.checkValidity()) {
field.classList.add('is-invalid');
Expand All @@ -78,6 +79,18 @@ document.addEventListener('DOMContentLoaded', function() {
}
}

// Checkbox validation for question2
const checkboxGroup = document.querySelectorAll('input[name="question2"]:checked');
if (checkboxGroup.length === 0) {
// If no checkboxes are selected, show validation error
const errorMessage = document.querySelector('input[name="question2"]').parentElement.querySelector('.invalid-feedback');
errorMessage.style.display = 'block';
isValid = false;
} else {
// If checkboxes are selected, hide validation error
const errorMessage = document.querySelector('input[name="question2"]').parentElement.querySelector('.invalid-feedback');
errorMessage.style.display = 'none';
}
return isValid;
}

Expand Down

0 comments on commit 80d9256

Please sign in to comment.