Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I would like to retrieve values from a lookup column (pull down) using SPServices() and load an array in javascript. This is available only in Newform.aspx. How can I do this?

share|improve this question
add comment

1 Answer

Instead of looking at it as pulling values from a lookup column, pull values from the list the lookup column is referencing.

here's a quick example of pulling out records and loading a drop down list

$().SPServices({
    operation: "GetListItems",
    listName: "Business Types",
    async: false,
    CAMLViewFields: "<ViewFields><FieldRef Name='ID'/><FieldRef Name='Title'/><FieldRef Name='RequiredDocuments'/></ViewFields>",
    CAMLQuery: "<Query><Where><Eq><FieldRef Name='ParentType' /><Value Type='Choice'>" + bizType + "</Value></Eq></Where></Query>",
    completefunc: function (xData, Status) {
        var tmp = "";
        var subTypes = $("#ddlBusinessSubtype");
        subTypes.find("option").remove(); //clear out the existing ones if they exist

        $(xData.responseXML).find("[nodeName='z:row']").each(function () {
            subTypes.append("<option value='" + $(this).attr("ows_ID") + "'>" + $(this).attr("ows_Title") + "</option>");
        });

        setSubtypeValues();
    }
});

HTH

share|improve this answer
    
I will try that .. thanks –  Arun Nov 2 '11 at 13:37
    
i Tried this but it is not working .. What is the BIZ TYPE??? in the query field??.. Can you please let me know.. I do have the same requirement. –  sandy_9866141457 Jan 28 at 13:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.