I’m using the following code (somewhat abridged):
BehaviourAlert = {};
BehaviourAlert.URL = 'http://url/to/script.php';
BehaviourAlert.User_ID = UWA.Environment.user.id;
BehaviourAlert.User_Human;
BehaviourAlert.init = function() {
Frog.API.get('users.getInfo',
{
'params': {'id': BehaviourAlert.User_ID },
'onSuccess': BehaviourAlert.setUserHuman,
'onError': function(err) { alert(err); }
});
$('input#submit').click(BehaviourAlert.processAlert);
}
BehaviourAlert.processAlert = function() {
var Room = $('input#Room').val();
if (Room.length < 1) {
alert("Please let the Main Office know in which room you require assistance.");
return false;
}
var Reason = $('textarea#Reason').val();
var Urgency = $('select#Urgency').val();
User_Human = encodeURI(BehaviourAlert.User_Human);
Room = encodeURI(Room);
Reason = encodeURI(Reason);
var URL_Create_Alert = "?cmd=createAlert&User_ID=" + BehaviourAlert.User_ID + "&Room=" + Room + "&Reason=" + Reason + "&Urgency=" + Urgency + "&User_Human=" + User_Human;
UWA.Data.getText(BehaviourAlert.URL + URL_Create_Alert, BehaviourAlert.finalise);
return false;
}
BehaviourAlert.finalise = function(data) {
alert(data);
window.location.reload(true);
}
/* -- WIDGET ONLOAD */
widget.onLoad = function(){
BehaviourAlert.init();
}
There is additional code, but IE throws no errors until I hit the input button with “submit” ID.
The code works as expected in FireFox – when the submit button is pressed, the JS makes a request to my PHP script which queries a database and sends a simple message response back to the JS to say that everything has worked correctly. An alert button appears in FireFox with this message.
However, in Internet Explorer, I get the following:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Fri, 6 Jan 2012 10:24:37 UTC
Message: Object doesn't support this property or method
Line: 37
Char: 13
Code: 0
URI: http://my.frog.server/uwa/js/compiler.php?url=%2Fuser%2F74%2F170980.html&v=6b3fdcf8766f759b62bcbd2c7ba7b2b9
Unfortunately, this “compiler.php” has nothing to do with me – I’m developing a widget for the Frog Virtual Learning Environment. When I’ve had this error before, it’s been to do with the script I’ve written, but “line 37” on “compiler.php” doesn’t tell me anything about where the problem lies within my files.
I’m using jQuery and the UWA stuff in my script is all to do with the widget code developed specifically for the VLE.
FireBug returns no errors or warnings at all.
Thanks in advance,
Answering my own question again, d’oh.
Need to initialise the variables for IE apparently.