Online RFP Builder Tool
`;const blob = new Blob([fullHtml], { type: 'text/html' });
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `RFP-${document.getElementById('projectTitle').value || 'Project'}.html`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}// Event listeners for form interactions
document.addEventListener('DOMContentLoaded', function() {
// Checkbox selection styling
document.querySelectorAll('.checkbox-item').forEach(item => {
item.addEventListener('click', function() {
const checkbox = this.querySelector('input[type="checkbox"]');
checkbox.checked = !checkbox.checked;
this.classList.toggle('selected', checkbox.checked);
});
});// Radio selection styling
document.querySelectorAll('.radio-item').forEach(item => {
item.addEventListener('click', function() {
const radio = this.querySelector('input[type="radio"]');
const name = radio.name;
// Clear other selections in same group
document.querySelectorAll(`input[name="${name}"]`).forEach(r => {
r.closest('.radio-item').classList.remove('selected');
});
radio.checked = true;
this.classList.add('selected');
});
});// Auto-save functionality
const inputs = document.querySelectorAll('input, textarea, select');
inputs.forEach(input => {
input.addEventListener('change', function() {
const data = collectFormData();
sessionStorage.setItem('rfpData', JSON.stringify(data));
});
});// Load saved data if available
const savedData = sessionStorage.getItem('rfpData');
if (savedData) {
const data = JSON.parse(savedData);
Object.keys(data).forEach(key => {
const element = document.getElementById(key);
if (element) {
element.value = data[key];
}
});
}
});// Initialize the wizard
showStep(1);