Monday, October 28, 2013

Build querystring from form field data

Here's a simple way of getting form field data from a SharePoint form, adding that data to a URL, and then causing the browser to navigate to that URL.  It assumes a form named MyForm and a textbox element named TextBox1.  Additional parameters can be added as needed. This gets you started:

function setMyFormURL()
  var string = document.getElementById('Textbox1').value;
  var urlString = '~/sitepages/myFile.aspx?fn=' + string;
  document.location.href = urlString;
OnClientClick='JavaScript:setMyFormURL();return false;'


No comments: