3

I'm making a issue list that should have link to a document library. After registrered I want the dispform.aspx to show a link to the library with filter on the ID from the issue list.

I know ID can't be fetched from the form, but is it possible to retrieve it from the http address and put it in with the link with javascript?

/Forms/AllItems.aspx?FilterField1=look&FilterValue1=My ID from HTTP

//Stian

2 Answers 2

1

In SharePoint you can use _spGetQueryParam to get a url param like your ID (details on my blog)

var id = _spGetQueryParam("ID");
var url = "/Forms/AllItems.aspx?FilterField1=look&FilterValue1=" + id;
1
0

Yes, it is possible to get item Id from display (or edit) form address. They usually have this kind of address:

Lists/Announcements/DispForm.aspx?ID=35&So 

You can parse ID attribute using this javascript:

var regex = new RegExp("[\\?&]ID=([^&#]*)");
var itemIdValue = regex.exec(window.location.href);
var itemId = itemIdValue[1];

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.