Opened 11 years ago
Closed 11 years ago
#11051 closed defect (fixed)
fileUploader fileMask broken
Reported by: | rmasse | Owned by: | Mike Wilcox |
---|---|---|---|
Priority: | high | Milestone: | 1.5 |
Component: | DojoX Form | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Specifically with version 1.4.3, the fileMask property of the dojox.form.fileUploader does not apply the supplied mask within the file dialogue.
If you downgrade to a previous version with the same code, it works fine.
Sample code below:
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head>
<title>Flash HTML</title> <link href="/tools/dojo/dijit/themes/dijit.css" rel="stylesheet" /> <link href="/tools/dojo/dijit/themes/tundra/form/Button.css" rel="stylesheet" /> <link href="/tools/dojo/dijit/themes/tundra/ProgressBar.css" rel="stylesheet" /> <link href="/tools/dojo/dojox/form/resources/FileUploader.css" rel="stylesheet" />
<script> djConfig = {
isDebug: false,
popup:true,
parseOnLoad: true
}
</script>
<script src="/tools/dojo/dojo/dojo.js"></script>
<script>
dojo.require("dojox.form.FileUploader?"); dojo.require("dijit.form.Button");
dojo.require("dijit.ProgressBar?");
dojo.addOnLoad(function(){
var fileMask = ["PDF Files", "*.pdf"];
var props = {
isDebug:false, hoverClass:"uploadHover", activeClass:"uploadPress", disabledClass:"uploadDisabled", uploadUrl:dojo.moduleUrl("dojox.form", "/tools/uploadPDF.php"), fileMask:fileMask, flashFieldName:"uploadFiles"
}
if(dojo.byId("btnF")){
dojo.byId("fFiles").value = ""; var f = new dojox.form.FileUploader?(dojo.mixin({
progressWidgetId:"progressBar", showProgress:true, fileListId:"fFiles", tabIndex:5, selectMultipleFiles:true, deferredUploading:false
},props), "btnF");
dojo.connect(dijit.byId("fSubmit"), "onClick", function(){
f.submit(dojo.byId("formF"));
});
dojo.connect(f, "onChange", function(dataArray){
console.log("onChange.data:", dataArray);
});
dojo.connect(f, "onComplete", function(dataArray){
dojo.forEach(dataArray, function(d){
});
});
}
});
</script>
<style>
html, body{
font-family:sans-serif; font-size:12px;
}
.uploadBtn{
border:1px solid #333333; background:url(/tools/dojo/dijit/themes/soria/images/buttonEnabled.png) #d0d0d0 repeat-x scroll 0px top; font-size:14px; font-family:Arial; width:195px; height:30px; line-height:50px;
vertical-align:middle; /* emulates a <button> */ text-align:center;
}
.uploadHover{
background-image:url(/tools/dojo/dijit/themes/soria/images/buttonHover.png); cursor:pointer;
font-weight:bold;
} .uploadPress{
background-image:url(/tools/dojo/dijit/themes/soria/images/buttonActive.png);
}
.uploadDisabled{
background-image:none; background-color:#666; color:#999; border:1px solid #999; font-family:serif; font-style:italic;
} .progBar{
width:294px; display:none;
} .form{
width:300px; border:1px solid #ccc; margin:5px; padding:3px; position:relative;
} .form, .thumbList{
float:left;
} .thumbList{
width:300px; border:1px solid #ccc; min-height:100px; margin:5px; padding:3px;
} #fFiles, #hFiles{
width:200px; height:75px; overflow-x:hidden; overflow-y:auto; border:1px solid #ccc;
} .form .field{
width:197px;
} .tbl{
width:100%;
} .tbl td{
width:50%; vertical-align:top;
} .form label{
position:absolute; width:80px; text-align:right; left:0px;
} .form .field, .form .btn{
margin-left:85px; margin-bottom:5px;
} h3{
width:600px; font-weight:normal; font-size:14px;
} ul{
font-size:12px; width:600px;
}
</style>
</head> <body class="tundra">
<h1>FileUploader? Widget Form Test</h1>
<table class="tbl">
<tr>
<td> <form id="formF" class="form">
<input type="hidden" name="relationId" value="123" /> <label>Files:</label> <div id="fFiles" class="field"></div> <div tabIndex="1" id="btnF" class="uploadBtn btn">Select Files</div> <button tabIndex="6" id="fSubmit" class="btn" dojoType="dijit.form.Button">Submit</button> <div indeterminate="false" id="progressBar" class="progBar" dojoType="dijit.ProgressBar?"></div>
</form>
</td> </tr>
</table>
</body> </html>
Change History (3)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Milestone: | tbd → 1.5 |
---|---|
Owner: | changed from dante to Mike Wilcox |
[]; ? |
Ran into same bug. Trip-killer is in postMixInProperties() dojox/form/FileUploder.js, line 412 (1.4.3):
this resets anything passed to constructor with empty array. This string is new to 1.4.3 - typo I guess.