How to enforce Alternate Text on Images with MCMS

Although I’m not really a friend on enforcing this for every image – there are always some images in a site which are only there to beautify the site which don’t have a message – here are some tips if you really need to enforce this.

There are three dialogs that have to be adjusted: one for images from the resource gallery, one for images from the local drive and the property window where the ALT tag can be changed later.

Be sure to backup the original files before doing any modification!


Here is the required patch to enforce images for the resource gallery item

<MCMS-Dir>\Server\IIS_CMS\WebAuthor\Dialogs\ResourceBrowser
    \Authoring\ImagePropertiesBrowse.aspx

Below the HandleKeyPress Javascript routine add the following routine:

 function CheckAltTag()
    {
  if (NC_LocalForm.NC_AltText.value != “”)
   return true;
  else
  {
   alert(“Please provide an Alternate Text for this Image”);
   return false;
  }
 }

In addtion you need to change the following line:
<button id=”NCImg_Insert” onclick=”WBC_procsImage(‘<%= PlaceholderName %>’, ‘<%= PlaceholderType %>’, ‘<%= Resource.Url %>’); return false;”

As follows:

<button id=”NCImg_Insert” onclick=”if (CheckAltTag()) {WBC_procsImage(‘<%= PlaceholderName %>’, ‘<%= PlaceholderType %>’, ‘<%= Resource.Url %>’);} return false;”


For local attachments do the following:

<MCMS-Dir>\Server\IIS_CMS_SortedDialogs\WebAuthor\Dialogs\ResourceBrowser
    \Authoring\ImageLocalBrowse.aspx

Add the following Javascript code to the HEAD section:

<script language=”JavaScript” type=”text/javascript”>
 function CheckAltTag()
     {
  if (NC_LocalForm.NC_AltText.value != “”)
   return true;
  else
  {
   alert(“Please provide an Alternate Text for this Image”);
   return false;
  }
 }
</script>

In addition you need to adjust the onsubmit property of the <FORM…> tag:

onsubmit=’if (CheckAltTag()) {return WBC_validateLocalPath(“Image”)} else {return false;}


For the property window do the following:

<MCMS-Dir>\Server\IIS_CMS_SortedDialogs\WebAuthor\Dialogs\ResourceBrowser
    \Authoring\ImagePropertiesOnlyBrowse.aspx

Add the following Javascript code to the HEAD section:

<script language=”JavaScript” type=”text/javascript”>
 function CheckAltTag()
     {
  if (NC_LocalForm.NC_AltText.value != “”)
   return true;
  else
  {
   alert(“Please provide an Alternate Text for this Image”);
   return false;
  }
 }
</script>

In addtion you need to change the following line:
<button id=”OKButton” onclick=”WBC_setImageProp( ‘<%= PlaceholderName %>’ ); return false;”

As follows:

<button id=”OKButton” onclick=”if (CheckAltTag()) {WBC_setImageProp( ‘<%= PlaceholderName %>’ );} return false;”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.