Link to home
Start Free TrialLog in
Avatar of Isaac
IsaacFlag for United States of America

asked on

Dynamic multi select

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);
});	  

		}
		});
}

Open in new window

Avatar of Scott Fell
Scott Fell
Flag of United States of America image

You do have errors

Uncaught ReferenceError: documentGetElementsByName is not defined DeliverWebpart.aspx:908
Uncaught ReferenceError: MoveSiteTitle is not defined DeliverWebpart.aspx:915
Avatar of Isaac

ASKER

That's not code created by me.  That's generated by SharePoint.  How did you get Reference Errors?  There is not sign of errors on the page.
SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial