1

I have a list with country name and country code, I am using the list while creating a form and selecting the country code when a user selects a third column 'select country' which is a calculated column. And I am passing the country code to a javascript-->

 ="<a href='javascript:SelectCountry("&countryCode&")'>Select Country</a>"

But the issue is that when the return type is 'single line of text' no hyperlink is coming, and if I select return type as 'Number' hyperlink is creating and in my case my return type is countrycode(which is like CZ,US,IN,CN etc) which is not number.

How can I implement a calculated column having return type 'single line of text' and the column should be a hyperlink.

1

How can I implement a calculated column having return type 'single line of text' and the column should be a hyperlink.

Not, outputting HTML is an undocumented feature that only works with non-Text datatypes

Datatypes:

  • Single Line of Text
    outputs the Calculation result as bare text (showing all HTML tags)

  • Number
    outputs correct HTML, but wrapped in an extra DIV, aligning the result to the right

  • Date
    outputs correct HTML, aligned to the left

Your problem is your HTML syntax is missing quotes, you need extra doublequotes so the Formula outputs a single doublequote:

="<a href='alert(""" & countryCode & """)'>Select Country</a>"

Better to read with reversed use of quotes:

="<a href=""alert('" & countryCode & "')"">Select Country</a>"

used the alert for Proof of Concept, you can use any JavaScript

  • Thanks for the answer but result is still the same hyperlink shown as HTML. – Arun Bhandari Jul 15 '16 at 6:57
  • And your Datatype is Number or Date? What does ="<h1>Hello</H1" output? And remember this does NOT work on Forms, only in Views – Danny '365CSI' Engelman Jul 15 '16 at 8:11

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.