I have a SharePoint custom list form with a bunch of Javascript running on it. In particular I have one field where it gets its choices from a lookup to another list. The lookup returns n versions of each choice depending on how many times that choice is used in the lookup list (e.g. the option "Classification" appears 9 times in the lookup list because there are 9 records with "Classification" as a subject). I'm getting the titular error on my form when my Javascript tries to filter the options so I only have one copy of each choice in the drop-down.
While the code successfully filters the options, what happens is that when I try to save the item, I get "Something Went Wrong".
My code looks something like this:
$(document).ready(function(){
getSubjects();
});
function getSubjects(){
var namesArray=[];
var optionSelected = $("select[title='Subject'] option:selected").val();
var subject=$("select[title='Subject'] option:selected").text();
$("select[title='Subject']").html("");
$("select[title='Subject']").append("<option value='none'>(None)</option>");
var url = _spPageContextInfo.webServerRelativeUrl + "/_vti_bin/ListData.svc/Services?select=Id,SubjectValue&$orderby=QuestionSubject asc";
$.getJSON(url,function(data){
console.log("Subjects");
console.log(data.d.results);
$.each(data.d.results, function(index, item){
if(item.Active==true && namesArray[item.SubjectValue]!=1){
$("select[title='Subject']").append("<option value='"+item.Id.toString()+"'>"+item.SubjectValue+"</option>");
namesArray[item.SubjectValue]=1;
}
});
$("select[title='Subject'] option[value='"+optionSelected+"']").attr('selected','selected');
});
getServices(subject);
}
}
createRange
any place on this page except in your question?