How to cancel SWFUpload dialog open?

313 Views Asked by At

I have a situation where it is somtimes not appropriate to upload files (The page elements need to be in some conditions for the user to be able to upload files). In that case, I want to show the user alert box explaining the reason without opening the file select dialog box.

So what I want to do is,

function beforeDialogOpen() {
  if ($('#txt1').val().length == 0)
    alert('Please fill in the field first.');
    return false;  // cancel
  else
    return true;   // proceed
}

set this event handler.

1

There are 1 best solutions below

1
Niko Sams On BEST ANSWER

I would simply hide the SWFUpload flash button and put another html on it's place that looks just the same. In the click event you display your error message.

Or it could even have a grayed-out disabled look and simplay do nothing.