I have a custom SharePoint list form where I would like to have country names(from another list) in one row with a check box in front of each row. On checking of any check box in front of country name, a text box should be enabled for each country where user can write the city name. I can get the country name using rest api and get the array of countries. Now how to implement the check box and city functionality?? Dynamically I need to have check box and a td where this text box should appear for number of countries called. Please advice...sharepoint 2013 client side javascripts/ jquery.

Country name1 □ ______
Country name2 ■ Sydney

1 Answer 1


To get the checkbox in front of the country Name you can do like this:

You can either use REST or SPServices for this, I have done this using SPServices,

    operation: "GetListItems",
    async: false,
    listName: "Country List",
    completefunc: function (xData, Status) {
    if(Status == 'success' )
            var value= $(this).attr("ows_ID");
            var text = $(this).attr("ows_Title");
                            title: text,
                            id: value
             $("BoxIDToAppendControl").append ( "<input id='chk_" + value + "' type='checkbox' value='" + value + "' onchange='GenerateTextBox()'/><label for='chk_" + value + "'>" +Conuntry Name + "</label>" );           


Now In GenerateTextBox function you can write the following code

$(container).append('<input type=text class="input" id=tb' + iCnt + ' ' +
                            'value="Text Element ' + iCnt + '" />');

Hope this helps

  • No SPServices. SP Services is not recommended for our project.
    – ankit
    Commented Aug 10, 2015 at 6:30
  • I said you can use REST api as well, I used SPService in my solution, you can use whatever you want and fill that country array accordingly, or else can directly traverse the data[] array of REST results Commented Aug 10, 2015 at 6:33
  • Did your question got solved? Commented Aug 13, 2015 at 6:32
  • Yeah did it...It was nt that difficult as I thought of..binder the html using rest services...It worked
    – ankit
    Commented Aug 30, 2015 at 13:20

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.