I hope I'm in the right group this is a first. My office is new to using Jquery and on this problem we are all wandering around in the wilderness. We use IE, sharepoint and are doing web parts. On a single web part we need to do several queries on a list to fill several select/combo boxes. The data list I'm working with for self training and to narrow down the problems is:
PLANT DEPT EMPLOYEE 1 1A EMP 1 1 1A EMP 2 1 1A EMP 3 1 1B EMP 4 1 1B EMP 5 1 1B EMP 6 1 1C EMP 7 1 1C EMP 8 1 1C EMP 9 2 2A EMP 10 2 2A EMP 11 2 2A EMP 12 2 2B EMP 13 2 2B EMP 14 2 2B EMP 15 2 2C EMP 16 I need query (1) to fill a select/combo box for PLANT (distinct value) that then unhides the DEPT select box. I have gotten a query to get the data and fill the select box but can't seem to find out how to make the query distinct. (See script below) Then with the selected value for Plant I needed a query (2) for DEPT. Followed by a query (3) for related employees. I can write individual Jquery code to do each list as individual web parts but writing one script (web part) to do 2 or more queries eludes me. The query done last is the one that produces a list. Could someone provide or point me to a example where this is done? Thanks for your effort and time. Here is the first query I used for Plant: <script type="text/javascript" src="https://psns.imfb.navy.mil/pages/ jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var soapEnv = "<soapenv:Envelope xmlns:soapenv='http:// schemas.xmlsoap.org/soap/envelope/'> \ <soapenv:Body> \ <GetListItems xmlns='http://schemas.microsoft.com/ sharepoint/soap/'> \ <listName>Demo_Test_Data</listName> \ <viewFields> \ <ViewFields> \ <FieldRef Name='Plant' /> \ <FieldRef Name='Dept' /> \ <FieldRef Name='Employee' /> \ </ViewFields> \ </viewFields> \ <query> \ <Query> \ <OrderBy> \ <FieldRef Name='Plant' /> \ <FieldRef Name='Dept' /> \ <FieldRef Name='Employee' /> \ </OrderBy> \ </Query>\ </query> \ </GetListItems> \ </soapenv:Body> \ </soapenv:Envelope>"; $.ajax({ // Tell where the lists is located that is to be read url: "/sites/C1230/C1237/tbbo/_vti_bin/lists.asmx", type: "POST", dataType: "xml", data: soapEnv, complete: GetSubjectParams, contentType: "text/xml; charset=\"utf-8\"" }); }); function GetSubjectParams(xData, status) { $(xData.responseXML).find("z\\:row").each(function() { var strListItem = "<option value=" strListItem = strListItem + "<option value='" strListItem = strListItem + $(this).attr("ows_Plant") strListItem = strListItem + "'>" strListItem = strListItem + $(this).attr("ows_Plant") strListItem = strListItem + "</option>" //Put data into the list when it is unique and not already there $("#lstPlant").append(strListItem); }); // End of function //Hide the title line so we have more space for data //$("#onetidPageTitleAreaTable").hide(); // }; </script> <Table cellspacing=0 cellpadding=0 style="align:left; font-family:Times; background:LightGoldenRodYellow; background:GreenYellow; font-weight:bold; color:black; width=99%"> <col align="left" /> <th colspan=4> <b>Site Parameters And Subject Settings</b> </th> <tr> <td width="25%"> </td> <td width="25%"></td> <td width="25%"></td> <td width="25%"></td> </tr> <tr> <td style="background=Khaki"> <select id="lstPlant" style="align:left; font-family:Times; background=LightSkyBlue; font-weight:bold; color:black; width=90%"> <option value="All">All</option> </select> </td> <td style="background=Tan"> <select id="lstDept" style="align:left; font-family:Times; background=MediumTurquoise; font-weight:bold; color:black; width=90%"> <option value="Something">Something</option> </select> </td> <td style="background=Coral"> <select id="lstEmployee" style="align:left; font-family:Times; background=LightPink; font-weight:bold; color:black; width=90%"> <option value="AnotherSomething">AnotherSomething</ option> /select> </td> <td style="background=Olive"> </td> </tr> </table>