Disable double click to prevent multiple execution

November 19th, 2010

There are still users who double clicks a link or button and web developers sometimes need to do a workaround to avoid the action being triggered twice in a row. (For instance adding an item to a database or downloading a generated file)

All the scripts and workarounds I found on the web for disabling doubleclick was unneccesary complex and disabled the link/button forever after being clicked once, without the possibility to click again unless reloading the page. So I had to dig out something I wrote a long time ago, which disabled double click but only for a short while.

This nasty little javascript disables any link with a single onclick statement, and works fine with ASP.NET controls also by writing OnClientClick=”return disableDoubleClick()” as an attribute. Click on the download link to open the demo.

<script type="text/javascript">
disableDoubleClick = function() {
        if (typeof(_linkEnabled)=="undefined") _linkEnabled = true;
        setTimeout("blockClick()", 100);
        return _linkEnabled;
    blockClick = function() {
        _linkEnabled = false;
        setTimeout("_linkEnabled=true", 1000);
Test it here:<br />
<a href="http://shahinalborz.se/wp-content/uploads/2010/11/dummy.zip">Standard download link</a> | 
<a onclick="return disableDoubleClick()" href="http://shahinalborz.se/wp-content/uploads/2010/11/dummy.zip">Link with disabled doubleclick</a>

EPiServer CMS 6 Filemanager thumbnail bug

November 15th, 2010

In the Filemanager there’s a checkbox stating “Show thumbnails” which is supposed to show thumbnail images in the file list. We discovered that the images shown are in fact still full size.

I reported this tiny bug in the filemanager of EPiServer CMS 6 (6.0.530.0) a few days ago, and although EPiServer could reproduce it, I’m still confused by the fact that some websites with the very same version works, while others don’t.

Anyway, a quick-and-very-dirty fix for this is to modify [Program Files]\EPiServer\CMS\6.0.530.0\Application\UI\CMS\Hosting\Browse.ascx by adding
style=”max-width:60px; max-height:60px”
to the EPiServer:HostingThumbnailImage tag. Actually, that is pretty much what the CMS does when it works.

Reported as Bug #59137 – Thumbails in the Filemanager are normal size

This was actually NOT a bug in EPiServer, but (foolishly) a control adapter which was included in several projects (and I wasn’t aware of existed) that collided with the HostingThumbnailImage control inside EPiServer CMS. We solved this by inheriting EPiServer.UI.WebControls.ControlAdapters.HtmlHeadAdapter instead of System.Web.UI.WebControls.Adapters.WebControlAdapter in the custom image adapter.

ColorPicker – EPiServer custom property

October 11th, 2010

Some of the best ideas are not advanced, but very simple. 🙂

My first post is a very simple custom property type (for EpiServer CMS) which enables editors to pick a color instead of typing a hexcolor. Needless to say, setting limited access to such properties are highly recommended.

Read the rest of this entry »