I recently updated to Nintex Forms 2010 (1.11.4.0) and my javascript has stopped working when using the IE 11 browser. If I use Chrome it works fine. It has been working for over a year and suddenly stopped with the update. I was running a CAML query to populate form controls based on a lookup. I have discovered that if I change the compatibility to Edge, then I am able to get the javascript to run in IE. This makes it impossible to edit pages however. Is there something I can change in the code to make it compatible with IE 11?
NWF$(document).ready(function () {
//Get Form control values
var employeeNumber = NWF$("#" + txtEmployeeNumber + ":input").val(); //NWF$(".employeeNumber :input").val();
var selectedEmployee = NWF$("#" + ddlSelectedEmployee + ":input").val(); //NWF$(".selectedEmployee :input").val();
alert("Employee Number: " + employeeNumber + "
Employee ID: " + selectedEmployee);
//Determine if the employee number has been entered and the selected employee is blank
//If the employee number is not blank and the selected employee is, then set the selected employee
//Otherwise, do nothing. The form is new
if (employeeNumber != null && selectedEmployee == 0) {
selectEmployee();
alert("Select Employee");
} else {
alert("Do not select Employee");
}
});
function getEmployeeNumber() {
//Get Form control values
var employeeNumber = NWF$("#" + txtEmployeeNumber + ":input").val();
var selectedEmployee = NWF$("#" + ddlSelectedEmployee + ":input").val();
alert("Employee Number: " + employeeNumber + "
Employee ID: " + selectedEmployee);
//Connect to Employee Numbers list on SharePoint
var context = new SP.ClientContext.get_current();
var list = context.get_web().get_lists().getByTitle("Employee Numbers");
//Build query
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(
"<View><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + selectedEmployee + "</Value></Eq></Where></Query><ViewFields><FieldRef Name='Title' /></ViewFields></view>");
//Execute Query and determine if it was successfull.
var listItems = list.getItems(camlQuery);
context.load(listItems);
context.executeQueryAsync(onSuccess, onFail);
//Run if the query is successful
function onSuccess() {
var listItemEnumerator = listItems.getEnumerator();
while (listItemEnumerator.moveNext()) {
var listItem = listItemEnumerator.get_current();
var title = listItem.get_item('Title');
}
//alert(title);
//Check to see if the selected employee is the same, if not, then make it the same
if (employeeNumber != title) {
NWF$("#" + txtEmployeeNumber + ":input").val(title);
}
alert("Employee Number: " + title + "
Number: " + title + "
ID: " + employeeID);
}
//Run if the query fails
function onFail() {
alert("Failed to query user.");
}
}
function selectEmployee() {
//Get Form control values
var employeeNumber = NWF$("#" + txtEmployeeNumber + ":input").val();
var selectedEmployee = NWF$("#" + ddlSelectedEmployee + ":input").val();
//alert("Employee Number: " + employeeNumber + "
Employee ID: " + selectedEmployee);
//Connect to Employee Numbers list on SharePoint
var context = new SP.ClientContext.get_current();
var list = context.get_web().get_lists().getByTitle("Employee Numbers");
//Build query
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(
"<View><Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + employeeNumber + "</Value></Eq></Where></Query><ViewFields><FieldRef Name='ID' /></ViewFields></view>");
//Execute Query and determine if it was successfull.
var listItems = list.getItems(camlQuery);
context.load(listItems);
context.executeQueryAsync(onSuccess, onFail);
//Run if the query is successful
function onSuccess() {
var listItemEnumerator = listItems.getEnumerator();
while (listItemEnumerator.moveNext()) {
var listItem = listItemEnumerator.get_current();
var employeeID = listItem.get_item('ID');
}
//alert(employeeID);
//Check to see if the selected employee is the same, if not, then make it the same
if (selectedEmployee != employeeID && employeeNumber != "" && employeeID != null) {
NWF$("#" + ddlSelectedEmployee + ":input").val(employeeID);
} else if (selectedEmployee == employeeID) {
//Do Nothing
} else {
//Reset the form
NWF$("#" + ddlSelectedEmployee + ":input").val(0);
NWF$("#" + txtEmployeeNumber + ":input").val("");
}
//alert("Employee Name: " + employeeName + "
Number: " + title + "
ID: " + employeeID);
}
//Run if the query fails
function onFail() {
alert("Failed to query user.");
}
}
//function reloadForm(){
// location.reload();
//}