How to make a text a hyperlink in additional comments section?

Patiha
Kilo Contributor

Hi Community,

I have a requirement where when a agent adds a text which is a URL in to additional comments it should be appeared as a hyperlink. Currently whatever is added in to the additional comments appear as a text. How to make a text in to hyperlink. 

Note: Whenever I want to add comments randomly i want that to be changed to hyperlink.

Thanks!!

7 REPLIES 7

Aman Kumar S
Kilo Patron

You have to specific tags for enabling clickable link,[code][/code]

[code]<a href="https://google.com" target="_blank">Google</a>[/code]
Best Regards
Aman Kumar

Hi Aman,

We want the end users to be able to add the hyperlinks to the comments. As they will not be aware of this code tags. We want the comments section to find out if the text contains www or https then make it a hyperlink in the comments when submit. Any idea?

Thanks!!

You can before update BR, and you can have condition as additional comments changes, then you can do the below code(not testes it, but should look something like this)

var commentsUrl = current.comments.getJournalEntry(1);
var re = /^(http[s]?:\/\/){0,1}(www\.){0,1}[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,5}[\.]{0,1}/;
if(re.test(url)) {
current.comments = "[code]" +commentsUrl +"[/code]";
}
Best Regards
Aman Kumar

Hi @Patiha 

Is your issue resolved?


Feel free to mark correct, if your issue has been resolved, so it ends up in solved queue.

Will be helpful for others looking for the similar query.

Best Regards
Aman Kumar