var listName = "Countries"; var countryID = form.GetControl("CountryID").GetValue(); if (!countryID) { callback({Data: "No ID given yet"}); //return empty string if no ID is given return; } //Load the Country for the given ID var loader = new pf.sp.DataLoader(); loader.LoadRecord({ ListTitle: listName, Id: countryID }, function(e) { if (e.Error) { alert("Error: " + e.ErrorMessage); callback({Data: ""}); return; } var country = e.Data; if (country) { //if a record is found, return its title callback({Data: country.Title}); } });
This results are similar to the following: