diff --git a/Server-Side Components/Server Side/Remove HTML Tags/README.md b/Server-Side Components/Server Side/Remove HTML Tags/README.md new file mode 100644 index 0000000000..75f13e4e25 --- /dev/null +++ b/Server-Side Components/Server Side/Remove HTML Tags/README.md @@ -0,0 +1,5 @@ +Removing the HTML tags from the HTML fields in the list view. +For example, the 'Fix Notes' field in the problem table is an HTML field and displays with all the HTML tags in the list view. +The screenshot below shows a difference in the list view. + +image diff --git a/Server-Side Components/Server Side/Remove HTML Tags/script.js b/Server-Side Components/Server Side/Remove HTML Tags/script.js new file mode 100644 index 0000000000..6b54ed7841 --- /dev/null +++ b/Server-Side Components/Server Side/Remove HTML Tags/script.js @@ -0,0 +1,12 @@ +//Create a new string field called 'Fix Notes(u_fix_notes)' in the problem table. +//Select the 'calculated' checkbox in the field dictionary, and add the code to the script section. +//This would be helpful if you want to export HTML fields in a report. +(function calculatedFieldValue(current) { + var htmlText = current.fix_notes; // Getting the value of the current fix notes (HTML field) + var decodedText = htmlText.replace(/&#(\d+);/g, function(match, dec) { + return String.fromCharCode(dec); + }).replace(/<[^>]*>/g, '').replace(/&/g, '&').replace(/</g, '<') + .replace(/>/g, '>').trim(); + return decodedText; +})(current); +