Tags

, ,

Is very easy to create SharePoint survey by the end users. Normally it covers all requirements, but there is only one minus. Very often, users click “Save and close” button instead of the “Next”, which creates incomplete results. Out of the box, you are allowed to see only complete results and only incomplete results created by you. That’s why I think is a very good idea to hide “Save and close” button and force users to complete all the questions. Definitely we can have some help from JavaScript.

function pageLoad() {
    var buttons = document.querySelectorAll('input[type="button"]');
    for(var j = 0; j < buttons.length; j++) {
        var button = buttons[j];
        if(button.value === 'Save and Close') {
            button.style.display = 'none';
        }
    }
}

Place this code in a text file, upload it on the server and display the content using a content editor web part you place on the page. Because you include everything in “pageLoad” function it will be executed when page is loading or after a postback.

Advertisements