Surveys and Outreach

Get Involved. Join the Conversation.

Topic

    Bruno Aun
    How to pass an Incident ID to a SurveyAnswered
    Topic posted October 28, 2019 by Bruno AunBlue Ribbon: 750+ Points 
    23 Views, 1 Comment
    Title:
    How to pass an Incident ID to a Survey
    Summary:
    Need to pass an Incident ID to a hidden field (question)
    Content:

    Hi everyone,

    I need to pass an incident ID to a survey page and retrieve it as one of the question's responses.

    I've found out that I can use Javascript to capture the query string params and store it as a hidden question.

    So, I can write the Javascript code to parse the paramenter, no problem, but my question is:  

    How can I edit the question in HTML format, so that I can place the question inside a DIV (this way I can ID the HTML element in JS and also make it invisible)?

    Is this the right approach anyways?

     

    thanks in advance!

    Best Comment

    Bruno Aun

    Solved the requirement by adding HTML content to the Survey ans placed the following Javascript

    <script language="JavaScript" type="text/javascript">
    var inc = document.getElementsByClassName("incidentId");
    var urlParams = new URLSearchParams(window.location.search);
    inc[0].value = urlParams.get('req');
    </script>

    Comment

     

    • Bruno Aun

      Solved the requirement by adding HTML content to the Survey ans placed the following Javascript

      <script language="JavaScript" type="text/javascript">
      var inc = document.getElementsByClassName("incidentId");
      var urlParams = new URLSearchParams(window.location.search);
      inc[0].value = urlParams.get('req');
      </script>