Stump the Panel: SharePoint Q&A

Immediate solutions for common SharePoint questions
It is currently Wed May 22, 2013 6:54 pm

All times are UTC - 5 hours [ DST ]


Forum rules


What you are viewing is an archive of Stump the Panel. It remains for reference purposes. Please post all new questions on NothingButSharePoint.com
https://www.nothingbutsharepoint.com/sites/eusp/Forum



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Get Survey Ino
PostPosted: Tue Jun 08, 2010 1:52 pm 
Offline

Joined: Mon Jun 07, 2010 4:42 pm
Posts: 6
Hi all,

Here is the scenario that I have. I have a multiple step Survey that will be filled out my multiple users multiple times. After a user has filled out the first page I would like the value for a Vendor/Supplier to show at the top of each of the edit pages from that point on.

I have come to the following conclusions:

  • Use jQuery and SPServices
  • Use the GetListItems operation
  • Use the ID that is appended to the Query string to query the list and get the value that was entered on the first page

Two issues that I am running into:
  • How can I pull the ID from the query string? Is something like this correct?
    Code:
    var ID = $(this).attr("ows_ID");
  • Once I have the ID how can I pull back just that record to get my needed value for display?

I am looking to display something like this at the top of the survey.
Vendor: Georgie

Thanks for all previous, current and future help!!! Jim


Top
 Profile  
 
 Post subject: Re: Get Survey Ino
PostPosted: Tue Jun 08, 2010 3:30 pm 
Offline

Joined: Mon Jun 07, 2010 4:42 pm
Posts: 6
Thanks to Jim Bob on another post that I made I was able to figure this out. See the code below:
Code:
<script type="text/javascript">
$(document).ready(function() {


    var SurveyID = getQuerystring('ID');
    var SupplierName = null;

    $().SPServices({
       operation: "GetListItems",
       async: false,
       listName: "Supplier Questionnaire", // Use Display Name of your survey list
       CAMLQuery: "<Query><Where><Eq>" +
                        "<FieldRef Name='ID' />" +
                        "<Value Type='Integer'>" + SurveyID + "</Value>" +
                       "</Eq></Where></Query>",
       completefunc: function(xData, Status) {
           SupplierName = $(xData.responseXML).find("[nodeName='z:row']").attr("ows_Which_x0020_Supplier_x0020_would");
                                     // Prepend 'ows_' to the StaticName of the Lookup column in your survey list
       }
    });
$('#Supplier').append('<strong>Supplier you are reviewing: ' + SupplierName + '</strong>');
});


function getQuerystring(key, default_)
{
  if (default_==null) default_="";
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
  else
    return qs[1];
}



</script>
<div id="Supplier"></div>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group