troubleshooting Question

Dynamic multi select

Avatar of Isaac
IsaacFlag for United States of America asked on
Microsoft SharePointjQuery
4 Comments1 Solution622 ViewsLast Modified:
I have been dealing with this a few days now and I finally have the code that should work but is not.
The code below causes no errors and it builds the html like it's supposed to but it's not rendering the way it should.  I have a column that has values delimited with a comma. (ex Contract A, Contract B)  Each value is supposed to highlight in the multi-select box when they click "Edit" to edit the form.  Please help!!  Below is the code that I have. See for yourself here (http://issharepoint.com/EE/Site%20Pages/DeliverWebpart.aspx) Click on the second "edit" link.  The alerts will show what the html looks like, which looks fine.

function getContractValue(performer)
{
	var appendThis = "";
	
$().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "Contracts",
    CAMLViewFields: "<ViewFields></ViewFields>",
    CAMLQuery:"<Query><Where><Eq><FieldRef Name='Performer'/><Value Type='Lookup'>" + performer + "</Value></Eq></Where></Query>",
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() { 
	  if($.inArray($(this).attr("ows_ContractName"),glbContractArray)!= -1)
	  {
		appendThis = "<option value='"+$(this).attr("ows_ContractName")+"' selected>"+$(this).attr("ows_ContractName")+"</option>";
	  }
	  else
	  {
		appendThis = "<option value='"+$(this).attr("ows_ContractName")+"'>"+$(this).attr("ows_ContractName")+"</option>";
	  }
	  alert(appendThis);
	  $("#drpdContract").append(appendThis);
});	  

		}
		});
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros