Morning all. We have just had the Christie release installed on our platform and a previously working HTML widget has stopped working with the error 'Malformed Javascript'. I have been told that FROG created this code for us originally. The code basically pulls data from the dataviewer and displays it in a custom way. After some investigation the error seems to be due to the line of code below. You get the error TypeError: Illegal module name "//dataviewer/models/form_model" in the console.
steal('//dataviewer/models/form_model.js').then(function()
Below is the full code and any help with this will be much appreciated. Matt
<style>
.greenshawTable {
background:#FFFFFF;
margin:20px;
width:90%;
font-size:12pt;
}
.greenshawTable th {
background:#CCCCCC;
}
</style>
<script>
var movementTable = $("<table>", {
id: Frog.Utilities.generateSimpleId()
});
movementTable.addClass('table');
movementTable.addClass('greenshawTable');
movementTable.html(
'<tr>'+
'<th><b>Attn</b></th>'+
'<th><b>Notice</b></th>'+
'<th><b>Submitted by</b></th>'+
'<th><b>Submitted time</b></th>'+
'<th><b>Day of Week</b></th>'+
'</tr>'
);
if (!Array.prototype.findIndex) {
Array.prototype.findIndex = function(predicate) {
if (this === null) {
throw new TypeError('Array.prototype.findIndex called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
var thisArg = arguments[1];
var value;
for (var i = 0; i < length; i++) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return i;
}
}
return -1;
};
}
steal('//dataviewer/models/form_model.js').then(function() {
var formUuid = '6334FCA52003E978E8C4EFC54BD6C5044AAD2E4CDCCBB0AE';
Dataviewer.Models.Form.findAll({
content_uuid: formUuid,
sort_dir: 'DESC',
sort_field: 'date',
limit:100
}).done(function(responseDataModel) {
//console.log(responseDataModel);
responseDataModel.forEach(function(data, index) {
var myArray = new Array('','','');
for (var i=0;i<3;i++) {
myArray[i]=data.fields[i].responses[0].response;
}
//console.log(trumpArray);
movementTable.append("<tr>"+
"<td>"+myArray[0]+"</td>"+
"<td>"+myArray[1]+"</td>"+
"<td>"+data.user.displayname+"</td>"+
"<td>"+
moment.unix(data.responded_on).format("HH:ss DD/MM/YYYY")+
"</td>"+
"<td>"+myArray[2]+"</td>"+
"</tr>"
);
});
//});
}).fail(function() {
// these are not the results you are looking for.
});
});
this.element.append(movementTable);
</script>