I am following this walkthrough to create a training registration solution in SharePoint 2010. I have read through all of the comments and suggestions and tried everything to get this to work properly! There is a calculated column with the following:

=IF(Closed=TRUE,"Closed for registration",IF(RemainingSeats>0,"<a href='#'
onclick='OpenLandLRegistration("&StaticID&")'>Register</a>","Class is Full"))

This works perfectly fine, except that in IE it doesn't create a url it just displays <a href='#' onclick='OpenLandLRegistration(9)'>Register</a>. The javascript that it is calling is:

<script type="text/javascript" src="http://(mysitenameiseditedout)/Training%20Center/SiteAssets/jquery-2.2.2.min.js"></script>
<script type="text/javascript">//Creates window and opens the infopath form
function OpenLandLRegistration(training_id){
var options = {
url:"/Lists/Attendees/Item/newifs.aspx?List=eab8c21a%2Da43f%2D41fa%2D9c82%2D65099e7855de&training_id=" + training_id,
width: 750,
height: 600,
dialogReturnValueCallback: DialogCallback,
dialogReturnValueCallback: RefreshOnDialogClose
function DialogCallback(dialogResult, returnValue){ }// Reformat the url in the calculated column to hyperlink
// Format link font size and weight
$('td.ms-formlabel:contains("Register")').siblings(".ms-formbody").css("font-size", "18px");
$('td.ms-formlabel:contains("Register")').siblings(".ms-formbody").css("font-weight", "bold");reformatCalculatedColumnUrl();function reformatCalculatedColumnUrl(){
});// Hides Columns
$(function() {$("a[name$='StaticID']").closest("tr").hide();

I have checked this in both Firefox and Microsoft Edge and the register link displays correctly. But our employees use IE, so I really need this to work there!

Any advice would be greatly appreciated!

  • Can you add a new question with the requirement you have for just the Form. – Danny '365CSI' Engelman May 31 '17 at 20:17


in June 2017, Microsoft disabled the use of JavaScript in a Calculated Column

That means given answers may not apply for newer SharePoint versions

For long explanation and work arounds see:
June 13th 2017 Microsoft blocked handling HTML markup in SharePoint calculated fields - how to get the same functionality back

Original answer:

Detailed walkthrough you refer to...

But it is the overly complex SP2007 way of converting Calculated Columns to HTML
with loads of lines of JavaScript code

Just set the datatype of your Calculated Column with HTML to Number

See http://www.viewmaster365.com/#/How

And the StaticID field and its Workflow are also not necessary, as the ID is available on the TR

This, in a Calculated Column set to Number, should show the ID:

    ="<a href='#' onclick=""{event.stopPropagation();"
    &"var ID=getItemIDFromIID(findIIDInAncestorNode(this));"
    &"}""><img src='/_layouts/images/VIEWREPORTSHH.png' width='20px'></a>"

See All the StackOverflow Posts using HTML/JavaScript in Calculated Columns


For limitting Entries/Form see:

  • I do have it as a number. The StaticID column was used because on the Calendar list there isn't an acutal ID column. Each event added does have an ID, but there isn't a column to call to retrieve that data. – Brandi May 31 '17 at 13:28
  • if ="<h1>Hello</h1>" in a Calculated Column (set to Number) on IE does not work (and you have a standard View) then I'd like to investigate.. if it does work then your syntax is wrong somewhere (note: its a pain to debug this trick) – Danny '365CSI' Engelman May 31 '17 at 13:46
  • Hello did not work in either IE or Firefox, it displayed as it does above! – Brandi May 31 '17 at 14:01
  • It does display correctly on list view with the column added in to the view. But, the issue is with the actual Default Display Form. I don't think I specified that! :) – Brandi May 31 '17 at 14:20
  • A Forms, that is where you do need the scripting approach, the Number trick only works in Views. But since you are adding script.. I wouldn't use a Column at all; just have the script get the ID from the URL and inject the Link into the page; no need for 2 columns and a workflow. – Danny '365CSI' Engelman May 31 '17 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.