1

I have SharePoint 2010 site and I need to send my users a Survey. I would like to add the corresponding ticket number to each survey via a unique query string

~/site/List/Survey/NewForm.aspx?ticketNumber=123456789

How would I go about using the above Query string to auto populate the single line of text ticketnumber question on the survey?

Any help would be greatly appreciated

1 Answer 1

2

As far as I know you can't, there is no built in OOB solution for this (at least not in 2010).

What you can do instead is to use jQuery and some JavaScript, like this:

$(function() {
  var fields = {};
  $('.ms-formbody').each(function() {
    var name = $(this).html().match(/FieldInternalName="([A-Za-z0-9]+)"/);
    if (name) fields[name[1]] = $(this).find('input');
  });

  // getParameterByName = http://stackoverflow.com/a/901144
  fields['Title'].val(getParameterByName('ticketNumber'));
 });
3
  • Thanks eirikb ... I am new to SharePoint ... if possible could you provide any details on how to implement this script
    – Craig
    Apr 15, 2014 at 6:52
  • That question is not really related to this post, but you google for it (first hit on google). What I would do though to just hack it in, something like this
    – eirikb
    Apr 15, 2014 at 6:57
  • Thanks Again Eirikb ... pulled away to another project, but this was most helpful!!
    – Craig
    Jun 5, 2014 at 14:49

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.