The Issue
I have struggled create a calculated column in my SharePoint list that renders a button with an onclick event to start a javascript function while passing two column values from the list item.
After searching the internet high and low for answers, I am convinced that this may not be possible with calculated columns. Is this even possible?
The SharePoint list
The user will select the "Active" button from the list item row and the Javascript function should start
The Javascript code to be started from the "Active" button
The button should create the following code for each list item:
<input type='button' value='Active' onclick='examplefunction(Title,Status)'/>")
For the first list item in the row this would be:
<input type='button' value='Active' onclick='examplefunction("Title 1","Active")'/>")
To correctly render the html, the following calculated column formula is used (formatted as a number):
=CONCATENATE("<input type='button' value='Active' onclick=","examplefunction('",Title,"','",Status,"')"," />")
The Javascript for the function (via a Content Editor webpart)
<script type="text/javascript">
function examplefunction(Title,Status) {
alert(Title);
alert(Status);
}
</script>
My results
I have tried countless times to write and rewrite the calculated column formula (with and without using CONCATENATE) but I cannot pass the title or status column values.
I usually get the following error in console:
Uncaught SyntaxError: Invalid or unexpected token
If this is possible, how would I write the formula? in the limited examples available online, I have not been able to replicate that success.