0

What is the purpose of the NewFormRedirect.aspx page located in [Domain]/[Site]/Custom Pages/ folder?

One of our SharePoint users got this page after creating an Item. I tried doing the same and after clicking "save" to create a new (test)item I was redirected to this page briefly before being redirected again to the Display form of the item for the item I had just created.

I found and opened the form in SharePoint Designer and it has a bit of code, but all it does for the user is display.

  Content Editor Web Part    

//Set up SPAPI (in my case I have installed SPAPI in Layouts directory) 

A Google search didn't turn up anything useful besides some Romanian public administrative body with a public accessible SharePoint site which also contained this page, so it must be a default SharePoint page. In which case I wonder why the comments are written in first person, (I have, I'm using, etc.) rather than some official Microsoft code comment style

here is the Romanian page mentioned for reference (the root page reveals that it's Rumanian) https://www.cjtulcea.ro/sites/cjtulcea/ServiciiElectronice/SiteAssets/Untitled_1.txt

this is the content of the form (located inside the <content> tags

<![CDATA[//Set up SPAPI (in my case I have installed SPAPI in Layouts directory)
<script src="[Domain Redacted]/Custom_js/SPAPI_Core.js" type="text/javascript"></script>
<script src="[Domain Redacted]/Custom_js/SPAPI_Lists.js" type="text/javascript"></script>
<script type="text/javascript">

//You may need do modify this function depending where your site collection is located
function GetRootUrl() {
    var pathparts = document.location.pathname.split('/');
    var url = 'https://' + document.location.host + '/' + pathparts[1] + '/NEC/TRACK';
    return url;
}

var lists = new SPAPI_Lists(GetRootUrl())

//quering last created item by current user
//i'm using _spUserId to get current user
var items = lists.getListItems(
        'Schools',   // listName
        '',         // viewName
        '<Query><OrderBy><FieldRef Name="Modified" Ascending="FALSE"></FieldRef></OrderBy><Where><Eq><FieldRef Name="Author" LookupId="TRUE"/><Value Type="Lookup">' + _spUserId + '</Value></Eq></Where></Query>',  // query
        '<ViewFields><FieldRef Name="ID"/></ViewFields>',  // viewFields
        '1',  // rowLimit
        '<QueryOptions><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns></QueryOptions>'  // queryOptions
    );

if (items.status == 200) {
    var rows = items.responseXML.getElementsByTagName('z:row');
    var lastID = rows[0].getAttribute('ows_ID');

    //redirect to wanted page using quered last item ID
    //here i'm redirecting to DispForm.aspx of newly cerated item
    var url = GetRootUrl() + "/Lists/Schools/DispForm_.aspx?ID=" + lastID + "&Source=%2FLists%2FSchools%2FAllItems%2Easpx"
    document.location.href = url;
}
</script>]]>

1 Answer 1

0

This isn't a standard SharePoint page. One source could be this: Redirect from NewForm.aspx to DispForm.aspx or EditForm.aspx of newly created item from www.sharepointdrive.com.

The purpose seems to be to redirect the user creating a new item to the corresponding display/edit form, which can be useful if you're creating some 1-to-many relationship and want to display the children on the same page. Then using the NewForm is a problem due to the lack of an assigned ID.

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.