This is a migrated thread and some comments may be shown as answers.

Setting Upload Enabled With Javascript Problem

1 Answer 37 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Paul Herzberg
Top achievements
Rank 1
Paul Herzberg asked on 25 Jun 2015, 07:31 AM

Hello,

My problem is this:

I have an upload control (Cloud or Async depending on the setup) in a mulitpage tab.

I have a checkbox that the user has to check to say that they have the right to upload the file.

I would like to disable the Upload until the user checks the checkbox

If I set the Upload Enabled to false in the code behind, when I set it to enabled with javascript (upload.set_enabled(true)) the Upload no longer functions (the file dialog does not open when the control is clicked).

I have tried to set upload.set_enabled(false) when the document is ready but this doesn't work  because the Upload is on a tab it isn't rendered until that tab is open, I think, and so a $find(uploadclientid)  in javascript returns null.

Is there a workaround for any of this?

 

Thank you

Paul Herzberg

 

1 Answer, 1 is accepted

Sort by
0
Paul Herzberg
Top achievements
Rank 1
answered on 25 Jun 2015, 07:50 AM

Hello again,

In writing this a solution occured to me. It seems to work:

function setFileEnabled(enabled, clientid) {
    var upload = $find(clientid);
    if (upload != null) {
        upload.set_enabled(enabled);
        if (enabled) {
            upload.deleteFileInputAt(0);
        }
    }
}

 

Thank you

 

Paul

Tags
Upload (Obsolete)
Asked by
Paul Herzberg
Top achievements
Rank 1
Answers by
Paul Herzberg
Top achievements
Rank 1
Share this question
or