Skip to content

Commit

Permalink
PDB File Selector:OnChange:enable/disable Upload button when set/not set
Browse files Browse the repository at this point in the history
On Change of PDB File Selector Control:
Enable "Upload ..." button when a file is selected
Disable "Upload ..." button when a file is not selected
  • Loading branch information
danjasuw committed Apr 9, 2021
1 parent 932afee commit a9bc277
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,19 @@ function attachPDBFileUploadHandlers() {

// enable upload button if they select a file
$fileField.change( function( eventObject ) {

$uploadButton.prop("disabled", false );

// get file to upload
var fileToUpload = document.getElementById("pdb-file-field").files[ 0 ];

if ( fileToUpload ) {

// Have file to upload
$uploadButton.prop("disabled", false );
} else {
// No file to upload
$uploadButton.prop("disabled", true );
}

});

// upload button defaults to disabled
Expand Down

0 comments on commit a9bc277

Please sign in to comment.