New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the Community Exchange, where community members ask and answer questions about DNN. To get started, just start typing your question below and either select one of the suggested questions or ask a new question of your own.

DNN 7 adding "Choose File" button in RadAsyncUpload control

Return to previous page

  • 5/8/2013
  • 6619 Views

Question:

Doug Campbell long time ago
I am upgrading a module to DNN 7 (7.0.5). I am using RadAsyncUpload (I have a Telerik license). When the page does a postback it adds a new button that says "Choose File" next to the teleric submit button. If I refresh the page it goes away.

Looking at the code in dnn.jquery.js it looks that this is inserting the button. How do I prevent this.

(function ($) {
$.fn.dnnFileInput = function () {
return this.each(function () {
var $ctrl = $(this);
if (this.wrapper)
return;

//if this.wrapper is undefined, then we check if parent node is a wrapper
if (this.parentNode && this.parentNode.tagName.toLowerCase() == 'span' && this.parentNode.className == 'dnnInputFileWrapper') {
return;
}

this.wrapper = $("<span class='dnnInputFileWrapper'></span>");
$ctrl.wrap(this.wrapper);
var text = $ctrl.data('text');
text = text || 'Choose File';
var btn = $("<span class='dnnSecondaryAction'>" + text + "</span>");
btn.insertBefore($ctrl);

$ctrl.change(function () {
var val = $(this).val();
if (val != '') {
var lastIdx = val.lastIndexOf('\\') + 1;
val = val.substring(lastIdx, val.length);
} else {
val = text;
}
$(this).prev().html(val);
});
});
};
})(jQuery);

How to I prevent this from happening in my module?

DNN 7 adding "Choose File" button in RadAsyncUpload control

Doug Campbell
Doug Campbell long time ago
Add an Answer

Answers

Sign In to Participate
Or register to become a member