0

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

2 Answers 2

0

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.

2
  • I am using SP 2010 Commented Jan 2, 2019 at 15:46
  • The same page I linked to has javascript for accomplishing this, which would work in 2010
    – Mike2500
    Commented Jan 2, 2019 at 16:06
0

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>

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.