Export (0) Print
Expand All

SharePoint Team Services: Updating Multiple Items in a List

SharePoint Team Services 1.1
 

Microsoft Corporation

September 2002

Applies to:
    SharePoint Team Services™ from Microsoft®

Summary: Learn how to create a tool for updating multiple items in a list on a Web site based on SharePoint Team Services™ from Microsoft® by using Collaborative Application Markup Language (CAML), remote procedure call (RPC) protocol, and script. (20 printed pages)

Contents

Introduction
Creating the UI
Creating Arrays for Field Names and Types
Prepopulating the Value Picker
Updating the Items
Complete Code Sample

Introduction

You can use a combination of Collaborative Application Markup Language (CAML), remote procedure call (RPC) protocol, and script to create a tool for updating multiple items in a list on a Web site based on SharePoint Team Services™ from Microsoft®.

  • CAML can be used in queries against the database to return fields or values.
  • RPC provides a vehicle to communicate with FrontPage® Server Extensions from Microsoft in order to work with lists.
  • Script can be used to construct the CAML and RPC strings that are posted to the server.

As in the sample for deleting items, the XMLHTTP and DOMDocument objects are used to make posts and get the values returned from the server. This example implements much of the code in the sample for deleting items.

Note   You must have Advanced Author permissions on the server to upload the samples and perform the required customizations presented in this article.

To update items based on user input, you must first post a CAML view to the server to get the identifiers (IDs) for the items that you want to update. After the IDs are returned, the following command must in turn be posted for each item ID:

http://[Server_Name]/[Subweb_Name]/_vti_bin/owssvr.dll? Cmd=Save&List=[List_Name]&ID=[ID]&urn:schemas-microsoft-com:office:office#[Field_Name]=[User_Value]

In addition to constructing and posting strings to update items, this sample shows how to create a form for the user interface (UI) that provides options for specifying two sets of criteria (the second set as optional), each with drop-down boxes for field and value pickers. The drop-down boxes are prepopulated to limit the user's need to type values. The user types replacement values in a text box, as illustrated in the following figure.

Dd582944.sts_updateitms_01(en-us,office.11).gif

Figure 1. User interface for updating items in a list

Note   The example in this article assumes that you have installed the Microsoft XML Core Services (MSXML) 4.0, formerly called the Microsoft XML Parser, on the client. Download the Core Services.

The code below can be put in an .htm file that also includes the required instructions for processing in SharePoint Team Services: a script block that writes the CAML HTMLBase element for relative links and a RedirectToFrame block that specifies the path to the page that the interpreter will process. In addition, this example assumes that you've added to the list's AllItems.htm page a link that passes the current list name as a parameter. For specific information on the formulation of these instructions and the link, see "Creating an AddItems.htm and its link" in Adding Multiple Items to an Existing List. (Note that, unlike for the adding items sample in that article, it is not necessary to pass the view's URL to the sample presented here.)

Creating the UI

You can create a field picker, such as the following, that integrates CAML with HTML to return the current list's fields and construct the drop-down box. The onchange event of the field picker SELECT box calls the PrePop function, to which it passes the field picker value, a reference to the associated value picker, and the box's ID.

<FORM name="frmUpdate" ID="frmUpdate">
   <TABLE class="ms-toolbar" cellpadding=5>
      <TR><TD colspan=2 class=ms-sectionheader>Update Items</TD></TR>
      <TR><TD COLSPAN=2>Select a field and the value to replace.</TD></TR>
   </TABLE>
   <TABLE class="ms-toolbar" CELLPADDING=5>
      <TR><TD>Field:
         <SELECT name="itmUpFld1" id="itmUpFld1" onchange="JavaScript:PrePop(document.frmUpdate.itmUpFld1.value, lstItmUp1, id);">
      <Option value="None" SELECTED>None
         <ows:ForEach Select="/FIELDS/Field">
            <Switch>
               <Expr><Property Select="Type"/></Expr>
               <Case Value="Computed"></Case>
               <Case Value="Note"></Case>
               <Case Value="URL"></Case>
               <Default>
                  <Switch>
                     <Expr><Property Select="Name"/></Expr>
                     <Case Value="Modified"></Case>
                     <Case Value="Created"></Case>
                     <Case Value="Author"></Case>
                     <Case Value="Editor"></Case>
                     <Case Value="ID"></Case>
                     <Case Value="PercentComplete"></Case>
                     <Default>
                        <HTML><![CDATA[<OPTION value="]]></HTML>
                        <Property Select="Name"/>
                        <HTML><![CDATA[">]]></HTML>
                        <Property Select="DisplayName" HTMLEncode="TRUE"/>
                    </Default>
                 </Switch>
              </Default>
           </Switch>
        </ows:ForEach>
     </SELECT>
</TD></TR>

The CAML part enumerates the Fields collection for the list and extends the SELECT box by adding OPTION elements that represent each field. It uses two Switch statements. The first Switch statement evaluates each field's type and excludes Computed, Note, and URL field types.

  • Computed fields are virtual fields that derive from actual fields contained in the database. A LinkTitle field, for example, displays a table's Title field value as a link, surrounding the value with an appropriate <A> tag. Consequently, Computed fields are excluded from the field picker, because they display values from actual fields, but also because they cannot be displayed properly in the picker.
  • Note fields are excluded because they cannot be used within a CAML Where clause and will return a "Render Failed" error message.
  • URL fields also cannot be implemented in the picker and are excluded.

The second Switch statement evaluates each field's name to exclude internal fields whose values cannot and should not be modified, and lays out the default rendering for other fields.

A skeletal drop-down list box can be added, which is populated based on user selection in the field picker.

      <TR><TD>Value:
         <SELECT name="lstItmUp1" id="lstItmUp1">
            <Option value="None" SELECTED>None
         </SELECT></TD></TR>

Next, you can add a box for the user to type in new values.

      <TR><TD>Type the new value:
         <INPUT TYPE="TEXT" ID="itmUp" VALUE=""></TD></TR>

The same code used here to define controls for a first set of criteria is used in the two controls of the second set, with the exception that in the second Switch statement, only the PercentComplete field need be excluded from the second field picker. Simply change the name attributes appropriately (here, to itmUpFld2 and lstItmUp2).

Finally, add an <A> tag whose href attribute calls the EditItems function to update the items selected.

      <TR><TD><A href="javascript:EditItems()" target=_self ID="UpdtItms" NAME="UpdtItms">Update Items</A></TD></TR>
   </TABLE>
</FORM>

Creating Arrays for Field Names and Types

This sample assumes that a script block contains two arrays: one that associates each field name with a type and another that associates each field's internal name with its display name. See the Creating Arrays for Field Names and Types section of Deleting Multiple Items from a List for a description of the example to implement here, or refer to the complete code sample at the end of this article.

Prepopulating the Value Picker

The PrePop function prepopulates the value picker based on user selection through the field picker. This function constructs the CAML view to post in order to return all the field's values from the database. It uses XMLHTTP to post the view, and it uses the XML Document Object Model (DOM) to parse the server's response and construct an array that contains the values returned. For each value, it adds an OPTION element to the value picker. The PrePop function also provides an added level of security by limiting the amount of data that has to be typed by the user.

The code sample presented here for updating items makes extensive use of the PrePop function described in the same section of Deleting Multiple Items from a List. The following code for trapping cases where the first criteria set is incomplete can be added near the beginning of the PrePop function in place of the same trap that is used in deleting items.

function PrePop(selField, lstItem, itmID)
{
   var strCol;
   var lenItms = lstItem.children.length;

   if ((itmID=="itmUpFld2") && (document.frmUpdate.itmUpFld1.value=="None"  
   ||     document.frmUpdate.lstItmUp1.value=="None"))
   {
      alert("The first set of criteria is incomplete.");
      document.frmUpdate.itmUpFld2.value="None";
      RemChildren(lenItms, lstItem);
      return;
   }

   RemChildren(lenItms, lstItem);

   if (selField=="None")
   {
      return;
   }

Other than the above trap, the remainder of the PrePop function can be identical to the sample presented for deleting items (see Deleting Multiple Items from a List or the complete code sample at the end).

Updating the Items

When the user selects a value in the UI and clicks Update Items, the EditItems function is called. The EditItems function uses XMLHTTP at two different points: first to return item IDs based on user selection and then to post the URL string for updating items. With only a few modifications, the same EditItems function described in Deleting Multiple Items from a List can be used here for updating items.

In place of the code used to assign control values to variables in the sample for deleting items—as well as the subsequent traps for invalid operators—you can use the following code for updating items.

function EditItems()
{
   var selField1;
   var selOp1;
   var lstItm1;
   var selField2;
   var selOp2;
   var lstItm2;

   selField1 = GetSelectedValue(document.frmUpdate.itmUpFld1);
   lstItm1 = document.frmUpdate.lstItmUp1.value;
   selField2 = GetSelectedValue(document.frmUpdate.itmUpFld2);
   lstItm2 = document.frmUpdate.lstItmUp2.value;
   newItm = document.frmUpdate.itmUp.value;
   selOp1 = "Eq";
   selOp2 = "Eq";

Note that, for updating items, the operator used is always an Eq element.

The same code used in deleting items for trapping incomplete criteria and formulating parts of the Where clause can be used here (see Deleting Multiple Items from a List—but in place of the code used for assembling the parts of the Where clause, the following code is used. First, the code checks whether a replacement value has been typed in the text box.

   if (newItm=="")
   {
      alert("A replacement value has not been specified.");
      return;
   }

   var wrnMultVal = "A field for a single item can equal only one value.";

   if (document.frmUpdate.itmUpFld2.value != "None")
   {
      if (selField1==selField2)
      {
         alert(wrnMultVal);
         return;
      }

      mkWhere = "&lt;And&gt;" + Where2 + "&lt;/And&gt;";
   }

The code for updating items, as for deleting items, also traps cases in which multiple values for the same field have been selected for an item. In the case of updating items, however, only "And" logic applies when both sets of criteria are specified. Other than this, the code is identical to the code used in the deleting items sample for constructing the complete string to post, and to the XML used to post the string and get the values returned from the server.

Issuing a Warning

The following section of code can be used in the EditItems function to warn users that they're about to update items; it can replace the equivalent section of the deleting items sample. Here, too, the message is dynamically constructed for the user, depending on whether both sets of criteria are being implemented.

   var strWarn;
   var strWarnUpdate = "Are you sure you want to replace " + 
      lstItm1 + " with " + document.frmUpdate.itmUp.value + 
      " for all items where the " + fldName[selField1] + 
      " field equals " + lstItm1;

   if (selField2=="None")
   {
      strWarn = strWarnUpdate + "?";
   }
   else 
   {
      strWarn = strWarnUpdate + " and the " + fldName[selField2] + " field equals " + " " +  lstItm2 + "?";
   }

Confirming Deletion

Finally, the following section for assembling and posting the URL command can be used in place of the warning and post formulation used in the deleting items sample.

   if (confirm(strWarn))
   {
      for (i=0; i<arrCnt; i++)
      {
         var upString = "<ows:HttpVDir/>/_vti_bin/owssvr.dll?Cmd=Save" + "&List=<ows:List/>&ID=" + arrEdit[i] + "&<ows:FieldPrefix/>" + selField1 + "=" + document.frmUpdate.itmUp.value;

         HTTPobj2 = new ActiveXObject("Msxml2.XMLHTTP.4.0");
         HTTPobj2.open("POST", upString, false);
         HTTPobj2.send();
      }
      window.parent.location = "<ows:ListUrlDir/>" + "/AllItems.htm";
   }
   else
   {
      return;
   }

As described in the article about deleting items, you need to include a function for replacing HTML encoding (here, RepCAML) in the strings being posted.

For more information about CAML, see the CAML reference in the SharePoint Team Services SDK.

Complete Code Sample

The following script block can be added to the <HEAD> of the page for updating items:

<SCRIPT language="JavaScript">

/*Construct an array that associates each field's name with that field's type. */
var fldType = new Array();
<ows:ForEach Select="/FIELDS/Field">
  <Switch>
    <Expr><Property Select="Type"/></Expr>
    <Case Value="Computed"></Case>
    <Default>
      <HTML><![CDATA[fldType["]]></HTML>
      <Property Select="Name"/>
      <HTML><![CDATA["] = "]]></HTML>
      <Property Select="Type"/>
      <HTML><![CDATA[";]]></HTML>
    </Default>
  </Switch>
</ows:ForEach>

/*Construct an array that associates each field's internal name with its display name. */
   var fldName = new Array;
   <ows:ForEach Select="/FIELDS/Field">
      <HTML><![CDATA[fldName["]]></HTML>
      <Property Select="Name"/>
      <HTML><![CDATA["] = "]]></HTML>
      <Property Select="DisplayName" HTMLEncode="TRUE"/>
      <HTML><![CDATA[";]]></HTML> 
   </ows:ForEach>


/*Use this function to prepopulate the value picker. */
function PrePop(selField, lstItem, itmID)
{
   var strCol;
   var lenItms = lstItem.children.length;

   if ((itmID=="itmUpFld2") && (document.frmUpdate.itmUpFld1.value=="None" ||  document.frmUpdate.lstItmUp1.value=="None"))
   {
      alert("The first set of criteria is incomplete.");
      document.frmUpdate.itmUpFld2.value="None";
      RemChildren(lenItms, lstItem);
      return;
   }

   RemChildren(lenItms, lstItem);

   if (selField=="None")
   {
      return;
   }

/*Create a different element for use in the mkWhere string, depending on field name or field type.*/
   if (fldType[selField]=="Lookup")
   {
      strCol = "&lt;LookupColumn Name=\"" + selField + "\"/&gt;";
   }

   else if (fldType[selField]=="DateTime")
   {
      strCol = "&lt;Column Format=\"ISO8601\"/&gt;";
   }

   else
   {
      strCol = "&lt;Column/&gt;";
   }

/*Complete construction of the string for posting a CAML view to the server to return values for the selected field. Use -,- as separator between values. Replace entities with angle brackets and quotation marks.*/
   var strMk = "<ows:HttpVDir/>/_vti_bin/owssvr.dll?Cmd=DisplayPost" + 
      "&PostBody=&lt;ows:Batch&gt;&lt;Method ID=&quot;itmIDs1" +
      "&quot;&gt;&lt;SetList&gt;<ows:List/>&lt;/SetList&gt;" +
      "&lt;View&gt;&lt;ViewFields&gt;&lt;FieldRef Name=\"" + 
      selField + "\"/&gt;&lt;/ViewFields&gt;&lt;ViewBody&gt;" +
      "&lt;Fields&gt;" + strCol + "&lt;HTML&gt;&lt;![CDATA[-,-]]&gt;" +
      "&lt;/HTML&gt;&lt;/Fields&gt;&lt;/ViewBody&gt;&lt;Query&gt;" +
      "&lt;OrderBy&gt;&lt;FieldRef Name=\"" + 
      selField + "\" Ascending=\"FALSE\"/&gt;&lt;/OrderBy&gt;" + 
      "&lt;/Query&gt;&lt;/View&gt;&lt;/Method&gt;&lt;/ows:Batch&gt;";

   var strMk = RepCAML(strMk);

/*Create XMLHTTP and DOMDocument objects for posting the view to the server and parsing the response.*/
   var HTTPob = new ActiveXObject("Msxml2.XMLHTTP.4.0");
   HTTPob.open("POST", strMk, false);
   HTTPob.send();
   var docObjRec = new ActiveXObject("Msxml2.DOMDocument.4.0");
   docObjRec.async = false;
   docObjRec.loadXML(HTTPob.responseXML.xml);
   docObjRec.setProperty("SelectionLanguage", "XPath");
   var valRet = docObjRec.selectSingleNode("//Results/Result");
   var strRet = valRet.text;

/*Remove the extra separator at the end and create an array to contain the values. */
   var Len1 = strRet.length - 3;
   strRetIDs = strRet.substr(0, Len1);
   var arIDs = strRetIDs.split(/-,-/);
   var aCnt = arIDs.length;

/*Using the number of elements in the array, iterate through all values and create OPTION elements to add to the value picker. When array elements repeat, do nothing.*/
   for (i=0; i<aCnt; i++)
   {
      if (arIDs[i]==arIDs[i+1])
      {}

      else 
      {
         var newItem = document.createElement("OPTION");
         lstItem.children(0).insertAdjacentElement("afterEnd",newItem);
         newItem.innerText = arIDs[i];
         strValue = arIDs[i].toString();
         var rep = /\$/;
         strVal = strValue.replace(rep,"");
         lstItem.style.width = "1";
         newItem.setAttribute("value", strVal);
         lstItem.style.width = "auto";
      }
   }
}

/*Remove options from the value picker when changes are made in the field picker. */
function RemChildren(lenChlds, lstItm)
{
   for (i=1; i<lenChlds; i++)
   {
      var remChld = lstItm.children[1];
      lstItm.removeChild(remChld);
   }
}

/*Get the user-entered data.*/
function GetSelectedValue(frmElem) 
{
   if (frmElem) 
   {
      itmVal = frmElem.options[frmElem.selectedIndex].value;
      return itmVal;    
   } 
   else
      return "";
}

/*Use this function to get IDs and delete items. Start by assigning user values to variables.*/
function EditItems()
{
   var selField1;
   var selOp1;
   var lstItm1;
   var selField2;
   var selOp2;
   var lstItm2;

   selField1 = GetSelectedValue(document.frmUpdate.itmUpFld1);
   lstItm1 = document.frmUpdate.lstItmUp1.value;
   selField2 = GetSelectedValue(document.frmUpdate.itmUpFld2);
   lstItm2 = document.frmUpdate.lstItmUp2.value;
   newItm = document.frmUpdate.itmUp.value;
   selOp1 = "Eq";
   selOp2 = "Eq";

/*Trap cases where the field or value picker equals None. */
   if (selField1=="None" || lstItm1=="None")
   {
      alert("The first set of criteria is incomplete.");
      return;
   }
   
   if ((selField2!="None" && lstItm2=="None") ||
      (lstItm1=="None" &&   lstItm2!="None"))
   {
      alert("The second set of criteria is incomplete.");
      return;
   }

/*Construct the operators specified by the user and create FieldRef elements. */
   var Op1 = "&lt;" + selOp1 + "&gt;";
   var Op2 = "&lt;/" + selOp1 + "&gt;";
   var Op3 = "&lt;" + selOp2 + "&gt;";
   var Op4 = "&lt;/" + selOp2 + "&gt;";
   var Fld1 = "&lt;FieldRef Name=&quot;" + selField1 + "&quot;/&gt;";
   var Fld2 = "&lt;FieldRef Name=&quot;" + selField2 + "&quot;/&gt;";
   var mkWhere;
   var Where1;
   var Where2;

/*Construct core parts of the Where clause for posting the CAML view.*/
   Where1 = Op1 + Fld1 + "&lt;Value Type=&quot;" + fldType[selField1] +  
      "&quot;&gt;" + lstItm1 + "&lt;/Value&gt;" + Op2;
   Where2 = Where1 + Op3 + Fld2 + "&lt;Value Type=&quot;" + 
      fldType[selField2] + "&quot;&gt;" + lstItm2 + "&lt;/Value&gt;" + Op4;

/*If the second criteria set is not used, create the shorter Where1 clause. */
   if (selField2 == "None")
   {
      mkWhere = Where1;
   }

/*Trap cases where the replacement value box is left empty. If the second criteria set is used, create the appropriate Where clause, but add handling for cases in which the same field is selected in both field pickers. Create the longer Where clause.*/
  if (newItm=="")
  {
      alert("A replacement value has not been specified.");
      return;
   }

   var wrnMultVal = "A field for a single item can equal only one value.";

   if (document.frmUpdate.itmUpFld2.value != "None")
   {
      if (selField1==selField2)
      {
         alert(wrnMultVal);
         return;
      }

      mkWhere = "&lt;And&gt;" + Where2 + "&lt;/And&gt;";
   }

/*Assemble the complete string to be posted for returning the IDs of items to update, and then remove HTML encoding.*/
   var strParam = "<ows:HttpVDir/>/_vti_bin/owssvr.dll?" +
      "Cmd=DisplayPost&PostBody=&lt;ows:Batch&gt;&lt;Method " +  
      "ID=&quot;Del1&quot;&gt;&lt;SetList&gt;<ows:List/>" +
      "&lt;/SetList&gt;&lt;View DisplayName=&quot;MyHiddenView" +
      "&quot;&gt;&lt;ViewFields&gt;" +
      "&lt;FieldRef Name=&quot;ID&quot;/&gt;&lt;/ViewFields&gt;" +
      "&lt;Query&gt;&lt;Where&gt;" + mkWhere + "&lt;/Where&gt;" + 
      "&lt;OrderBy&gt;&lt;FieldRef Name=&quot;ID&quot;/&gt;" + 
      "&lt;/OrderBy&gt;&lt;/Query&gt;&lt;ViewBody&gt;" +
      "&lt;Fields&gt; &lt;Field/&gt;" +
      "&lt;HTML&gt;<![CDATA[,]]>&lt;/HTML&gt;" +
      "&lt;/Fields&gt;&lt;/ViewBody&gt;&lt;/View&gt;" +
      "&lt;/Method&gt;&lt;/ows:Batch&gt;";

   var strPost = RepCAML(strParam);

/*Use XML HTTP to post the string to the server, and then create a DOM document object to contain and parse the server's response.*/
   var docObjReceive;
   var HTTPobj;
   var strReturn;
   var strIDs;
   var Len;

   HTTPobj = new ActiveXObject("Msxml2.XMLHTTP.4.0");
   HTTPobj.open("POST", strPost, false);
   HTTPobj.send();
   docObjReceive = new ActiveXObject("Msxml2.DOMDocument.4.0");
   docObjReceive.async = false;
   docObjReceive.loadXML(HTTPobj.responseXML.xml);
   docObjReceive.setProperty("SelectionLanguage", "XPath");
   strReturn = docObjReceive.selectSingleNode("//Results/Result");
   strRaw = strReturn.text;

/*Create an array to contain IDs of items to update. */
   Len = strRaw.length - 1;
   strIDs = strRaw.substr(0, Len);
   
   if (strIDs=="")
   {
      alert("Sorry, no items matching the specified criteria were found.");
      return;
   }

   var arrEdit = strIDs.split(/,/);
   var arrCnt = arrEdit.length;

/*Offer a warning to the user before modifying the items.*/
   var strWarn;
   var strWarnUpdate = "Are you sure you want to replace " + 
      lstItm1 + " with " + document.frmUpdate.itmUp.value + 
      " for all items where the " + fldName[selField1] + 
      " field equals " + lstItm1;

   if (selField2=="None")
   {
      strWarn = strWarnUpdate + "?";
   }

   else 
   {
      strWarn = strWarnUpdate + " and the " + fldName[selField2] + 
         " field equals " + " " +   lstItm2 + "?";
   }

/*If the update is confirmed, build a complete update string to post for updating each item and post the string to the server.*/
   if (confirm(strWarn))
   {
      for (i=0; i<arrCnt; i++)
      {
         var upString = "<ows:HttpVDir/>/_vti_bin/owssvr.dll?Cmd=" + 
            "Save&List=<ows:List/>&ID=" + arrEdit[i] + 
            "&<ows:FieldPrefix/>" + selField1 + 
            "=" + document.frmUpdate.itmUp.value;

         HTTPobj2 = new ActiveXObject("Msxml2.XMLHTTP.4.0");
         HTTPobj2.open("POST", upString, false);
         HTTPobj2.send();
      }
      window.parent.location = "<ows:ListUrlDir/>" + "/AllItems.htm";
   }

   else
   {
      return;
   }
}

/*Replace HTML encoding.*/
function RepCAML(theStr)
{
   var re;
   re = /&lt;/g;
   theStr=theStr.replace(re,"<");
   re = /&gt;/g;
   theStr=theStr.replace(re,">");
   re = /&quot;/g;
   theStr=theStr.replace(re,"\"");
   return(theStr);
}

</SCRIPT>

The following form can be placed in the <BODY> section of the page.

<FORM name="frmUpdate" ID="frmUpdate">
  <TABLE class="ms-toolbar" cellpadding=5>
    <TR><TD colspan=2 class=ms-sectionheader>Update Items</TD></TR>
    <TR><TD COLSPAN=2>Select a field and the value to replace.</TD></TR>
  </TABLE>
  <TABLE class="ms-toolbar" CELLPADDING=5>
    <TR><TD>Field: <SELECT name="itmUpFld1" id="itmUpFld1" onchange="JavaScript:PrePop(document.frmUpdate.itmUpFld1.value, lstItmUp1, id);">
      <Option value="None" SELECTED>None
         <ows:ForEach Select="/FIELDS/Field">
            <Switch>
               <Expr><Property Select="Type"/></Expr>
               <Case Value="Computed"></Case>
               <Case Value="Note"></Case>
               <Case Value="URL"></Case>
               <Default>
                  <Switch>
                     <Expr><Property Select="Name"/></Expr>
                     <Case Value="Modified"></Case>
                     <Case Value="Created"></Case>
                     <Case Value="Author"></Case>
                     <Case Value="Editor"></Case>
                     <Case Value="ID"></Case>
                     <Case Value="PercentComplete"></Case>
                     <Default>
                        <HTML><![CDATA[<OPTION value="]]></HTML>
                        <Property Select="Name"/>
                        <HTML><![CDATA[">]]></HTML>
                        <Property Select="DisplayName" HTMLEncode="TRUE"/>
                    </Default>
                 </Switch>
              </Default>
           </Switch>
        </ows:ForEach>
     </SELECT>
</TD></TR><TR>
    <TD>Value: <SELECT name="lstItmUp1" id="lstItmUp1">
       <Option value="None" SELECTED>None
    </SELECT></TD></TR>
    <TR><TD>Type the new value: <INPUT TYPE="TEXT" ID="itmUp" VALUE=""></TD></TR>
    <TR><TD COLSPAN=2>To specify the item more precisely, select an additional set of criteria.</TD></TR>
   <TR><TD>Field: <SELECT name="itmUpFld2" id="itmUpFld2"  onchange="JavaScript:PrePop(document.frmUpdate.itmUpFld2.value, lstItmUp2, id);">
      <Option value="None" SELECTED>None
         <ows:ForEach Select="/FIELDS/Field">
            <Switch>
               <Expr><Property Select="Type"/></Expr>
               <Case Value="Computed"></Case>
               <Case Value="Note"></Case>
               <Case Value="URL"></Case>
               <Default>
                  <Switch>
                     <Expr><Property Select="Name"/></Expr>
                     <Case Value="PercentComplete"></Case>
                     <Default>
                        <HTML><![CDATA[<OPTION value="]]></HTML>
                        <Property Select="Name"/>
                        <HTML><![CDATA[">]]></HTML>
                        <Property Select="DisplayName" HTMLEncode="TRUE"/>
                    </Default>
                 </Switch>
              </Default>
           </Switch>
        </ows:ForEach>
     </SELECT></TD></TR>
    <TR><TD>Value: <SELECT name="lstItmUp2" id="lstItmUp2">
   <Option value="None" SELECTED>None
    </SELECT></TD></TR>
    <TR><TD><BR></TD></TR>
    <TR><TD><A href="javascript:EditItems(document.all.UpdtItms.id)" target=_self ID="UpdtItms" NAME="UpdtItms">Update Items</A></TD></TR>
  </TABLE>
</FORM>

Show:
© 2014 Microsoft