Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Help with updating a Dropdown list based on another Dropdown list

$
0
0
I have a List with Title and Status. I have the main list that users enter the data and a field called Reason that references the List with the title and status. I have another Field called Urgent/Routine that I want to set based on the status of the Reason that they chose. The reason it is a dropdown is because I want the user to be able to change it. I have the following code but it doesnt set the dropdown value. Can someone help me?

$(document).ready(function() {

$("select[title='Reason']").change(function () {

var ReasonID = $("select[title='Reason']").val();

$().SPServices({
operation: "GetListItems",
async: false,
listName: "{B87006A8-B8BA-40D1-A569-4275CC023A63}",
CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Status' /></ViewFields>",

CAMLQuery: "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + ReasonID + "</Value></Eq></Where></Query>",

completefunc: function (xData, Status) {
  $(xData.responseXML).SPFilterNode("z:row").each(function() {

    var Status = $(this).attr("ows_Status");
    alert(Status);
    $("input[title='UrgentRoutine']").val(Status);
    $("textarea[title='Explain']").val(Status);

  });
}
});

});

});

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>