Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

get URL parameter into the survey text box

$
0
0

hi I am trying to get a URL parameter automatically copied to the text box in the sharepoint survey. 

for example my URL looks: 

http://sites/system/Lists/Systems%20Survey/NewForm.aspx?Source=http%3a%2f%2fsites%2fsystem%2fLists%2fSystems%2520Survey%2foverview.aspx&RequestID=1234

<script type="text/javascript" language="javascript"> 
_spBodyOnLoadFunctionNames.push("GetURLParameter"); 
function GetURLParameter(sParam) 
{    
var sPageURL = window.location.hash.substring(1);    
var sURLVariables = sPageURL.split('&');    
for (var i = 0; i < sURLVariables.length; i++) 
{        
var sParameterName = sURLVariables[i].split('=');        if (sParameterName[0] == sParam) 
{
alert(sParameterName[1]);
return sParameterName[1];        }    }}

document.forms['aspnetForm'].ctl00_m_g_d9f5e4f9_7e05_4a4d_88b7_a6b1dcdda667_ctl00_ctl01_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField.value=GetURLParameter('RequestID');
</script>


however, it does not work. 

Do you know why by the any chance? 

thanks in advance



Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>