SP List click new item Finish, read field value 'yes' to launch NewItem.aspx 'no' to Thank you.aspx

Shri-6058 326 Reputation points
2020-09-17T23:38:27.747+00:00

Hello,

I was trying this functionality in InfoPath and it was very easy to redirect based on value. I was asked to use the out of the box list Survey with 10 questions. The last question will be Want to add more? Yes/No, If value is Yes, I need to launch the same Survey newitem.aspx page. If no, redirect ThankYou.aspx page. Can you suggest some light?

I thought I can do it via Sharepoint workflow but its not smooth. I thought there may be a Javascript to handle upon 'Finish' to call one or the other aspx page. Any thoughts?

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,190 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,407 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,565 questions
{count} votes

Accepted answer
  1. Amos Wu-MSFT 4,051 Reputation points
    2020-09-21T03:05:42.167+00:00

    You could use SharePoint Designer to add two new Finish buttons to newForm.aspx.
    Detailed steps:https://sharepoint.stackexchange.com/questions/227917/sharepoint-2013-ootb-survey-redirect
    In order to distinguish the two buttons, I used different names.
    26026-image.png

    Code for your reference:button-code.txt
    Then we could display different finish buttons according to the selection status of the Want to add more question.
    26015-test46.gif
    Change button code for your reference:code.txt

    -------------------------------------
    Updated---------------------------------------
    Code to change Finsh button redirect page:28672-code.txt


    If the response is helpful, please click "Accept Answer" and upvote it.
    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.

    0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Shri-6058 326 Reputation points
    2020-09-24T01:28:10.747+00:00

    Thank you so much. For some reason, the GenFireServerEvent __commit __redirect Newform does not fire. The error says its not defined.

    Also, I was trying this in script editor instead of SharePoint designer. I was able to hide out of the box finish button but added custom button however I cant submit and launch newform.aspx

    Also, I went through the reference and tried using eventListner but nothing fires(or no errors) for document.addEventListener Is there a specific feature needs to be enabled?


  2. Shri-6058 326 Reputation points
    2020-09-24T01:45:54.307+00:00

    Uncaught ReferenceError: GenFireServerEvent is not defined


  3. Shri-6058 326 Reputation points
    2020-09-24T17:54:43.457+00:00

    The instructions provided in the link has a design view, code view with SharePoint 2013 5 years ago. SharePoint Designer design view no longer exist. If I delete existing button from code, and place the cursor within the td and try to insert form action button but no action result or popup appear. The code still shows no button code inserted, strange. It looks like no longer supported.

    Is there a way to achieve this in Jquery Javascript? I know that we can hide out of the box buttons on the UI page and add custom Submit Cancel buttons.

    Actually I have two source urls which is also working fine. Your method of adding two buttons to show according to the radio button selection might work just that I dont know how to hookup the url upon upon 'Finish' button and making sure that it submits the custom url.

    List Survey Newform.aspx?source=Thankyou.aspx
    List Survey Newform.aspx?source=NewFform.aspx

    0 comments No comments

  4. Shri-6058 326 Reputation points
    2020-09-25T05:46:49.457+00:00

    I cant change the existing structure. There are lots of automation already done and my company asked me to stick with the approach and do not create custom NewForm.aspx. The way I want to achieve is with Existing out of the box NewForm.aspx page. There must be a way to achieve this using Jquery or Javascript but some reason lot of options provided including presaveaction() doesnt work. I tried the SharePointdiary.com Javascript/Jquery approach and its no firing at all.

    I can hide both existing UI Finish and Cancel and then I can add custom buttons using script editor. I thought, I can call Commit and then redirect options. Its not working. please advise.