Question

Is it possible to send query string to newform.aspx of the survey form so it's pre-populated? (I am using SP 2010)

The question in survey list is created is ServiceTicketNumber and then renamed the question with spaces.

URL of new form will look like:

../newform.aspx?tid=tid748745
Was it helpful?

Solution 2

This post Populate Query String to new form helped me.

Credit also goes to this https://stackoverflow.com/questions/807878/javascript-that-executes-after-page-load

    <script type="text/javascript">

    // this line works for chrome only   window.addEventListener("load", function(){
        //....
    document.onreadystatechange = function(){
    if(document.readyState === 'complete'){

    var URL= String(window.location.href);
    //URL.substring(URL.indexOf("=")+1,URL.length)
    alert(URL.substring(URL.indexOf("=")+1,URL.length));
    document.getElementById("ctl00_m_g_a8ed3c5c_7048_43bd_b68a_52ec97ab99af_ctl00_ctl02_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField").value = URL.substring(URL.indexOf("=")+1,URL.length);

document.getElementById("ctl00_m_g_a8ed3c5c_7048_43bd_b68a_52ec97ab99af_ctl00_ctl02_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField").disabled = true;
    }
    }
    </script>

OTHER TIPS

You didn't specify the version of SharePoint you're using, but there are a variety of different techniques for this. Here is a detailed answer that covers how to do this using jslink in SharePoint 2013.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top