0
var selectOption2 = document.createElement("option");
        // alert(selectOption2);
         selectOption2.value = results[i].Name;
         alert(selectOption2.value);
         selectOption2.innerText = results[i].Name;
         alert(selectOption2.innerText);
         //alert(selectOption2.value);

        selectListItems2.appendChild(selectOption2);

I have a sharepoint list and Name is a column in that list. I am trying to get that name column value using javascript but it is showing undefined instead of the actual value of name column.

for title field and other field, the same code is working but it is not working for name field.

I have used the above code, is there anything wrong with the code.

  • are you using REST api for getting the data ? – Vishwas Goswami Oct 7 '15 at 7:06
  • what does the results indicate ? is it a variable or rest result ? – Vishwas Goswami Oct 7 '15 at 7:07
  • Check console.log(results) gives you – Atish Dipongkor - MVP Oct 7 '15 at 7:08
  • 1
    Name is an existing SharePoint columnname, so I suspect your Name column has a different InternalName – Danny '365CSI' Engelman Oct 7 '15 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.