Wikiwi Posted August 24, 2022 Report Share Posted August 24, 2022 I found another solution in removing HTML tags in the data saved in Rich text editor. This is more if an alternative to this solution. Specially for those who doesn't have access to Triggered action. First you would need another field in your table that will store the plain text version of the actual input. Put that field in your Submission form and add a HEADER and FOOTER in your DataPage. Go the the FOOTER of your DataPage and disable the HTML editor in the Advanced tab. Paste the code below in your footer: <script type="text/javascript"> //This will hide the field for the "plain" text var non_formatted_txt = document.querySelector("#InsertRecordFIELDNAME_2"); non_formatted_txt.style.display = "none"; document.addEventListener('BeforeFormSubmit', function(event) { //This will replace all the HTML tags with blank var input = document.querySelector("#InsertRecordFIELDNAME_1").value.replace(/<\/?[^>]+(>|$)/g, ""); non_formatted_txt.value = input; }); </script> NOTE: replace FIELDNAME_2 with the actual fieldname of your field for the "plain" text and replace FIELDNAME_1 with the actual field name of the rich text editor field. Sample input : Actual table value: Non formatted value: roattw 1 Quote Link to comment Share on other sites More sharing options...
roattw Posted October 31, 2023 Report Share Posted October 31, 2023 This is great, thanks! If you wanted to do this for 2 fields, would you just put a comma between the fieldname references?: <script type="text/javascript"> //This will hide the field for the "plain" text var non_formatted_txt = document.querySelector("#InsertRecordFIELDNAME1_html, InsertRecordFIELDNAME2_html"); non_formatted_txt.style.display = "none"; document.addEventListener('BeforeFormSubmit', function(event) { //This will replace all the HTML tags with blank var input = document.querySelector("#InsertRecordFIELDNAME1_text,InsertRecordFIELDNAME2_text").value.replace(/<\/?[^>]+(>|$)/g, ""); non_formatted_txt.value = input; }); </script> Quote Link to comment Share on other sites More sharing options...
PotatoMato Posted November 1, 2023 Report Share Posted November 1, 2023 Hi @roattw, you will need to use the queryselectorAll and have a separate "var" if you want to use 2 or more fields, <script type="text/javascript"> // This will hide the fields for the "plain" text var non_formatted_txt = document.querySelectorAll("#InsertRecordFIELDNAME1_html, #InsertRecordFIELDNAME2_html"); non_formatted_txt.forEach(function(element) { element.style.display = "none"; }); document.addEventListener('BeforeFormSubmit', function(event) { // This will replace all the HTML tags with blank for each field var input1 = document.querySelector("#InsertRecordFIELDNAME3_text").value.replace(/<\/?[^>]+(>|$)/g, ""); var input2 = document.querySelector("#InsertRecordFIELDNAME4_text").value.replace(/<\/?[^>]+(>|$)/g, ""); non_formatted_txt[0].value = input1; non_formatted_txt[1].value = input2; }); </script> -Potato Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.