I created an aspx page calling _spPageContextInfo to get information from the site.

If I include: <form id="Main" name="Main" runat="server"></form> on the body of the page spPageContextInfo brings all the information I need and runs the script just fine.

However, if I remove <form id="Main" name="Main" runat="server"></form> I get the following error: '_spPageContextInfo' is undefined and Unable to get property 'results' of undefined or null reference

I need to remove <form id="Main" name="Main" runat="server"></form> from the code as I want to add it the page to a webpart and webparts will not run with any reference to <form> in the code Any ideas? Thank you for the help.


It might be caused because your statement is running before _sppagecontextinfo loaded. Can you try to get the '_spPageContextInfo" in the document ready function and see still has an issue.

Thanks, Venkat Konjeti

| improve this answer | |

The answer was to understand how SP works. <form></form> is only needed when launching the page from outside SP.

I just needed to call _spPageContextInfo from within SP and included the script-page.aspx through the content editor's URL option.

| improve this answer | |

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.