0

I can use the following JS code on my main site to create an image link to pull up an input page just like when you click on the "+ Add new item" at the bottom of a list:

   <a onclick="javascript:NewItem2(event, &quot;https://website/sites/site/_layouts/listform.aspx?PageType=8&amp;ListId={AEB087E7-DA21-4DA8-BB9A-9073382B3ED4}&amp;RootFolder=&quot;);javascript:return false;"href="/_layouts/listform.aspx?PageType=8&amp;ListId={AEB087E7-DA21-4DA8-BB9A-9073382B3ED4}&amp;RootFolder=" target="_self">
   <img alt="BUT-Cont_New.gif" src="/sites/site/sub_site/SiteAssets/SitePages/NavyAdmin/BUT-Cont_New.gif"/></a>

I have used this same code (hopefully I didn't mis-copy some part of the code) many times throughout my site. I now have a sub-site where I'm trying to be able to click the image from a list on my primary site and be able to have input from the sub-site and have it input onto the primary site list. The error which comes after I click this is that the list I have referenced does not exist, which make sense because the list doesn't exist on this sub-site. What do I have to do differently with the above code to allow this New Item pop-up to work on my sub-site or can I even?

Doing some further research online, I can say I am basically using the method talked about on this page. I am using a core function to produce a New Item pop-up.

0

I believe you just need to change the GUID value for the 'ListId' field (in your code example, it is currently set to AEB087E7-DA21-4DA8-BB9A-9073382B3ED4) to match the list which you are trying to add items to. You can get this GUID by going into SharePoint Designer, selecting the list you are trying to add to, and copying its List Id on the properties page under 'List Information'.

  • Sorry, no. I am using the correct ListId. I appreciate you taking the time to answer. Like I said, the reason it doesn't recognize the ListId is because it doesn't belong to this site, even though it is a sub-site of where this list resides. – Pᴀᴜʟsᴛᴇʀ2 Feb 7 '14 at 23:13
  • Is the code you posted above the exact same code that works on the parent site? Same URLs and everything? – tyshock Feb 8 '14 at 14:45
  • Pretty close. I cannot use the exact URL due to it being on a secure network (and all that jazz), but the structure is the same ... the names are changed to protect the innocent :-) Everything else should be spot on ... at least I don't think I have made any syntax errors in translation. – Pᴀᴜʟsᴛᴇʀ2 Feb 8 '14 at 18:31

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.