I have two column country(dropdown) and Region(Textbox). When i select a value in country the respective region value should be populated in textbox. I have separate list containing the columns country and region with the data

How can i achieve this using query or script?

  • using infopath is also favorable
    – Arul
    Jul 12, 2013 at 7:03

2 Answers 2


Please write a function on DropDown change. In that function pass the selected value to CAML query on which will traverse through the region list till it matches the country name. Following is pseudo javascript code.

function onDDLChange(string countryName ) {

    MyObject.regionList = MyObject.web.get_lists().getByTitle("Region");
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml("<View><Query><Where><eq><FieldRef Name='RegionName' /><Value Type='Text'>" + countryName + "</Value></eq></Where></Query></View>");
    MyObject.regionList.listItems = MyObject.regionList.getItems(camlQuery);
    MyObject.context.load(MyObject.listItems, "Include(RegionName)");
    MyObject.context.executeQueryAsync(Function.createDelegate(this, Success), Function.createDelegate(this, Fail));     

in Success() you might want to just little bit of validation to see if more than one values are returned and need to get the appropriate value.


SharePoint Filtered Lookup Field may be helpful. http://filteredlookup.codeplex.com/

  • Can you please extend this answer with some code and an approach for solving OP's issue? Jul 12, 2013 at 10:57
  • I made that through Lookup field.....and got ID for those values which are selected....But i struck up with the conditions...
    – Arul
    Jul 15, 2013 at 10:53
  • I have not tried before. Thought it might come in handy.
    – Yılmaz
    Jul 15, 2013 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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