Cjxcz Odjcayrwl
Cjxcz Odjcayrwl

Reputation: 22847

dojox/form/Uploader processing onclick events in disabled state

I'm using the dojox/form/Uploader that's initially in disabled state:

<div class="claro">
    <button id="uploadNode">Upload</button>
</div>
require(["dojox/form/Uploader"], function(){

var u = new dojox.form.Uploader({
    label:"Uploader", multiple:false, uploadOnSelect:false, disabled: true},
"uploadNode");
u.startup()

})

The widgit is obviously displayed as disabled, but you can still click on it and make the upload. It is reproduced on FireFox and IE (11). I've made JsFiddle for that.

JsFiddle is for version 1.9.3, but it's happening in version 1.10.0.

How can I functionally (not only visually) disable dojox/form/Uploader? Is there any workaround or codefix I can apply?

Upvotes: 0

Views: 389

Answers (1)

vivek_nk
vivek_nk

Reputation: 1600

The buttons "disable" css is only inherited from the DOM object by the Uploader widget. All the handlers are initialized at the time of widget creation (i.e. when calling startup() function). And so is the onclick handler was attached during creation of Uploader widget.

Therefore, set the disabled after creating the widget (applies for other widgets too). Although, it might work on few widgets, it is not recommended.

u.set('disabled','true'); //after startup() call this

Check this jsFiddle

Upvotes: 1

Related Questions