Feature: disable preview button until CSV file is selected
Added validation to prevent users from submitting the upload form without selecting a file first. The preview button is now disabled by default and only enables when a file is selected, improving user experience and preventing empty form submissions. Changes: - Added IDs to file input and preview button - Button starts in disabled state - JavaScript listener enables button when file is selected - Button disables again if file selection is cleared
This commit is contained in:
@@ -113,4 +113,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
if (totalRows > pageSize) {
|
||||
showPage(0);
|
||||
}
|
||||
|
||||
// Enable/disable preview button based on file selection
|
||||
const csvFileInput = document.getElementById('csvFileInput');
|
||||
const previewButton = document.getElementById('previewButton');
|
||||
|
||||
if (csvFileInput && previewButton) {
|
||||
csvFileInput.addEventListener('change', function() {
|
||||
previewButton.disabled = !this.files || this.files.length === 0;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user