javascript code in textarea...clear empty {}

vio_mora

New Member
Hello,
In a textarea field i want to put a javascript code that contains empty {}
When re-editing in form or displaying on the details page, fabrik delete {}
Do not i want this to happen? How can i do that?
Thanks for the help and ... sorry for my english
 
... if (fn) {fn(a);}}}}var inc ={} ,incl=[];....
after saving, the list displays ok but not ok in detail page
when editing the recording, the content changes in
... if (fn) {fn(a);}}}}var inc = ,incl=[];....
 
And are you adding this using the element Javascript feature?

If so, what type of event is it - 'load', or something else?

-- hugh
 
I do not understand.
I just want to add a code in the textarea field and I can display it just as it is on the details page.
More exactly...i want to insert the code generated on https://cloud.highcharts.com and on the detail page i want to display the chart generated by this code,
Code example:
<div id="highcharts-6fffacc2-cab6-4509-9977-dadac9814f34"></div><script>
(function(){ var files = ["https://code.highcharts.com/stock/highstock.js","https://code.highcharts.com/highcharts-more.js","https://code.highcharts.com/highcharts-3d.js","https://code.highcharts.com/modules/data.js","https://code.highcharts.com/modules/exporting.js","https://code.highcharts.com/modules/funnel.js","https://code.highcharts.com/modules/annotations.js","https://code.highcharts.com/modules/solid-gauge.js"],loaded = 0; if (typeof window["HighchartsEditor"] === "undefined") {window.HighchartsEditor = {ondone: [cl],hasWrapped: false,hasLoaded: false};include(files[0]);} else {if (window.HighchartsEditor.hasLoaded) {cl();} else {window.HighchartsEditor.ondone.push(cl);}}function isScriptAlreadyIncluded(src){var scripts = document.getElementsByTagName("script");for (var i = 0; i < scripts.length; i++) {if (scripts.hasAttribute("src")) {if ((scripts.getAttribute("src") || "").indexOf(src) >= 0 || (scripts.getAttribute("src") === "http://code.highcharts.com/highcharts.js" && src === "https://code.highcharts.com/stock/highstock.js")) {return true;}}}return false;}function check() {if (loaded === files.length) {for (var i = 0; i < window.HighchartsEditor.ondone.length; i++) {try {window.HighchartsEditor.ondone();} catch(e) {console.error(e);}}window.HighchartsEditor.hasLoaded = true;}}function include(script) {function next() {++loaded;if (loaded < files.length) {include(files[loaded]);}check();}if (isScriptAlreadyIncluded(script)) {return next();}var sc=document.createElement("script");sc.src = script;sc.type="text/javascript";sc.onload=function() { next(); };document.head.appendChild(sc);}function each(a, fn){if (typeof a.forEach !== "undefined"){a.forEach(fn);}else{for (var i = 0; i < a.length; i++){if (fn) {fn(a);}}}}var inc = {},incl=[]; each(document.querySelectorAll("script"), function(t) {inc[t.src.substr(0, t.src.indexOf("?"))] = 1; }); function cl() {if(typeof window["Highcharts"] !== "undefined"){var options={"title":{"text":"Chart"},"subtitle":{"text":"My Untitled Chart"},"exporting":{},"chart":{"type":"pie","options3d":{"enabled":true,"alpha":45,"beta":0},"polar":false},"plotOptions":{"pie":{"allowPointSelect":true,"depth":35,"cursor":"pointer","showInLegend":true,"innerSize":"60%"},"series":{"dataLabels":{"enabled":false},"animation":false}},"series":[{"name":"SUM","turboThreshold":0}],"data":{"csv":"\"COUNTRY\";\"SUM\"\n\"USA\";30\n\"CHINA\";20","googleSpreadsheetKey":false,"googleSpreadsheetWorksheet":false},"yAxis":[{"title":{}}]};/*
// Sample of extending options:
Highcharts.merge(true, options, {
chart: {
backgroundColor: "#bada55"
},
plotOptions: {
series: {
cursor: "pointer",
events: {
click: function(event) {
alert(this.name + " clicked\n" +
"Alt: " + event.altKey + "\n" +
"Control: " + event.ctrlKey + "\n" +
"Shift: " + event.shiftKey + "\n");
}
}
}
}
});
*/new Highcharts.Chart("highcharts-6fffacc2-cab6-4509-9977-dadac9814f34", options);}}})();
</script>
 
When add item the code is saved ok in db. Problem appears when editing the item. The problem also appears in the detail page even if the code is saved ok.
 
Replicatable.
You can just put a blank inside the { }, then they are kept.
But this is only about single {} in the text.

There are good reasons that Joomla doesn't accept all HTML/JS code in fields per default so e.g. <script> will be stripped anyway.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top