0

We are sending the survey link to clients so they can evaluate our work.

The link they receive by email brings them here :

screenshot 1

Once they click there, they have to select the # of project that corresponds to their project. Problem is, the human is lazy and they dont read the instructions and never takes time to select the project number in the list : see screenshot #2 :

screenshot 2

What i'd like to, is have a direct link to the survey with the field No project already selected with the project number passed in a query string in anyway OR leave it blank by default so people make the effort to choose the right project number in the list. Because as of right now, the people leave the first project number and answer the questions, which is wrong.

2

You could add a content editor with some Javascript to set the default value for you based on a querystring parameter:

I'll borrow a routine to read the QueryString data from an SO answer here.

var QueryString = (function() {
    // This function is anonymous, is executed immediately and 
    // the return value is assigned to QueryString!
    var query_string = {};
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        // If first entry with this name
        if (typeof query_string[pair[0]] === "undefined") {
            query_string[pair[0]] = pair[1];
            // If second entry with this name
        } else if (typeof query_string[pair[0]] === "string") {
            var arr = [query_string[pair[0]], pair[1]];
            query_string[pair[0]] = arr;
            // If third or later entry with this name
        } else {
            query_string[pair[0]].push(pair[1]);
        }
    }
    return query_string;
}());

Now you can access query string values with a statement like QueryString['paramKey'] where paramKey is the name of the parameter in the query string.

Use your browser tools and find the ID of that selector on your page (they're usually crazy strings that have a guid in them), then you can use a basic Javascript statement to set the selected option to your querystring parameter:

document.getElementById('yourCrazySelectorId').value = QueryString['yourQueryStringParam'];

The value you'll need to use in your select is usually the id of the lookup option for the dropdown, but inspect the select dropdown (again with your browser dev tools) to identify what appropriate value matches which text.

  • Good answer but problem is the link brings them to the first screenshot, they have actually to click on "Answer this poll". If you tell me there's a way to bring them directly to the survey without clicking it i'd be more than happy to apply your solution. – Tommy Dubé-Leblanc Sep 3 '14 at 15:49
  • Go to your start page, open your browser dev tools and inspect the initial page request when you click the button -- I'll describe in chrome: clear the 'network' pane, click on your 'Respond to this Survey' button and scroll back up to see the second request for an aspx page, then use that as your URL -- it should look something like <site>/<subsite>/Lists/<SurveyLibrary>/NewForm.aspx?IsDlg=1 you could in theory remove the IsDlg=1 attribute, but play around with it either way – John-M Sep 3 '14 at 15:56
  • Oh -- and to make them go back to a specific location when they're done you cam use a querystring attribute called 'Source' -- so ...&Source=http://yourserver.com/home.aspx... or something similar (needs to be in the same site collection) and that will re-direct people after they click finish or cancel appropriately – John-M Sep 3 '14 at 16:07
1

When the Microsoft expert visited our company and provided us training, he gave us this tip: whenever you have a field of the "Choice" type, the first option should be "Select..." and it should be displayed by default, regardless of what type of data there will be in the choice menu. This way, if you see a "Select..." in your results then you can quickly identify that answer as garbage.

  • Agreed, but how do I add it ? The list is pre-loaded from another list and there is no blank or select... in it naturally. – Tommy Dubé-Leblanc Sep 3 '14 at 15:38

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.