-1

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. I show my question form in my DispForm for my list (I added my app as an app part) on DispForm. When I select a item and press on view item I see my question form just as I like it but I don't know how to get the right ID of that item I want to show. Someone have any suggestion? I use

listItem.set_item('Title', $('#Title').val());

to send data in to my SharePoint list and

and get_fieldValues to read it back

$('#Title').val(item.get_fieldValues().Title);
  • 3
    Please only post the relevant parts of your code and tell what's going wrong. It doesn't work here like "here's my problem and my code, solve it please". – Boland Nov 3 '14 at 8:29
  • Is it ok for you now? – linkan94 Nov 3 '14 at 8:46
  • You can retrieve it from the query string? It's parameter ID from the top of my head. – Boland Nov 3 '14 at 22:21
0

This is what i have done and working like i want it

itemId = decodeURIComponent(getQueryStringParameter('ID'));

if (itemId != 'undefined'){
    item = list.getItemById(itemId);
}

 if (itemId != 'undefined'){
        listItem = item;
    }
    else{
        var listCreationInformation = new SP.ListItemCreationInformation(), listItem = list.addItem(listCreationInformation);
    }

Your Answer

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

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