Enable button only after file selection

Hi all, i wonder if there is a way to enable a button only after a file is selected via an Upload Button. I though i could edit the onClick event for the Upload Button, but i see that there is none generated when i use it… like as if the button itself was an event-trigger that does not need coding for the click event.
Thanks in advance.

Hi Alessandro Demontis
Are you trying to do ? →

A button is disabled when the page loads…
Only after the user selects any file in the upload button, the button should be enabled …

If it is, then →

#uploadButton1 - Upload Button
#button1 - Button

$w.onReady(function () {
$w('#button1').disable();

 $w('#uploadButton1').onChange( (event) => {  //upload Button
  if($w('#uploadButton1').value.length > 0) {
   $w('#button1').enable();
  
  }
  else {
      $w('#button1').disable();
     }
 });
});

For Reference - >

Yes Ajit it is exactly what i wanted to do… i’ve modified your code a bit since i already had an onReady section. It works perfectly, thank you very much!!

2 Likes