I'm using SharePoint online and have a SharePoint-hosted app.

I have a page with a question form that send data in to Sharepoint using listItem.set_item('GEN_1_blabla', $('#GEN_1').val());

Now in my list when you click on an item it's open in DispForm.aspx and in there i have my question page again how can i get it to load the information to the textboxes in my question page.

I have read about get_fieldValues() but dont know how to get it to work.

var appContext, hostweburl, hostContext, parentWeb, list;

appContext = new SP.ClientContext.get_current();
hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
hostContext = new SP.AppContextSite(appContext, hostweburl);
parentWeb = hostContext.get_web();
list = parentWeb.get_lists().getByTitle("CoromaticIFU");

$(document).ready(function () {
    $('#GEN_4').datepicker({ dateFormat: 'yy-mm-dd' }).val();

function setItems() {
   var listCreationInformation = new SP.ListItemCreationInformation(), listItem = list.addItem(listCreationInformation);

    listItem.set_item('GEN_1_Sum_Scope_Assigment', $('#GEN_1').val());
    listItem.set_item('GEN_1_Sum_Scope_Assigment_D', $('#GEN_1_D').val());
    listItem.set_item('GEN_2_CRMname', $('#GEN_2').val());
    listItem.set_item('GEN_2_CRMname_D', $('#GEN_2_D').val());
    listItem.set_item('GEN_19_BYGG_GOLV', $('input[name="GEN19"]:checked').val());
    listItem.set_item('DRI_6_Personnel_Servicetype', $("#DRI_6 option:selected").text());

    appContext.executeQueryAsync(function (success) { alert("Din sparning lyckades!"); }, function (sender, args) { alert('Error:' + args.get_message()); });

I have tried this with get_fieldValues

function getItems()
    listItem.get_fieldValues('GEN_1_Sum_Scope_Assigment', $('#GEN_1').val());

    appContext.executeQueryAsync(function (success) { alert("lyckades!"); }, function (sender, args) { alert('Error:' + args.get_message()); });

  • listItem.get_fieldValues() returns the JSON containing the item values as {internalname1:value1,internalname2:value2,....} Oct 29, 2014 at 8:57
  • ok how can i write the code to get to work? Oct 29, 2014 at 9:16

1 Answer 1



var item = list.getItemById(92);

$(document).ready(function () {

appContext.executeQueryAsync(function () {
}, function (sender, args) { alert('Error:' + args.get_message()); });


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.