question

MichaelWilliams-3261 avatar image
0 Votes"
MichaelWilliams-3261 asked RaytheonXie-MSFT commented

Passing value from Parent Form to Modal Form in SharePoint 2016

Hello All,

I found an example to solve my issue, but the problem is that the Line below isn't working. Essentially the SPGetQueryString() isn't working in SharePoint 2016

var queryStringVals = $().SPServices.SPGetQueryString();



https://social.technet.microsoft.com/Forums/azure/en-US/7c58fba7-a095-4dc5-8008-65358edf7886/passing-a-query-string-parameter-to-a-newformaspx-modal-dialog?forum=sharepointdevelopmentprevious



$(document).ready(function() {

//Gets the supplierID from the URL
var queryStringVals = $().SPServices.SPGetQueryString();
var supplierID = queryStringVals["FilterValue1"];

//replaces the onlick attribute of the add new item link with a NewForm.aspx and my query string variable
var incidentHrefandSupplierID = "http://sp2010/sites/MySite/Lists/MyList/NewForm.aspx?SupplierID=" + supplierID;

//console.log(incidentHrefandSupplierID);
$('#WebPartWPQ10 #idHomePageNewItem').attr('href', '#');
$('#WebPartWPQ10 #idHomePageNewItem').attr('onclick', function () {
return "javascript:showDialog('" + incidentHrefandSupplierID + "');"

//console.log(this.onclick); });
});

sharepoint-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RaytheonXie-MSFT avatar image
0 Votes"
RaytheonXie-MSFT answered RaytheonXie-MSFT commented

Hi @MichaelWilliams-3261 ,
Please try to add jquery.min.js and jquery.SPServices-2014.02.min.js into a document library, then reference the files.

And add try...catch into your code.

 try {
   adddlert("Welcome guest!");
 }
 catch(err) {
   document.getElementById("demo").innerHTML = err.message;
 }

For sharepoint 2016, I will recommend REST API to achieve your requirement
https://social.technet.microsoft.com/wiki/contents/articles/31995.sharepoint-2013-working-with-rest-api-using-jquery-ajax.aspx


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MichaelWilliams-3261 ,
I am checking to see how things are going there on this issue.

0 Votes 0 ·
MichaelWilliams-3261 avatar image
0 Votes"
MichaelWilliams-3261 answered RaytheonXie-MSFT commented

Thank you RaytheonXie-MSFT, I will try the solution later next week and get back with you.



Michael

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MichaelWilliams-3261 ,
If you have any questions or progress, you can contact me in time.

Looking forward to your reply

Have a lucky day!

Thanks,
Raytheon Xie

0 Votes 0 ·
MichaelWilliams-3261 avatar image
0 Votes"
MichaelWilliams-3261 answered RaytheonXie-MSFT commented

I'm sure I already added the correct files, but I'll confirm at work tomorrow.

Thank You,


Michael Williams

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MichaelWilliams-3261 ,
Would you tell me whether your issue has been resolved or have any update?
I am looking forward to your reply.

Have a nice day!

Thanks,
Raytheon Xie

0 Votes 0 ·