title: Redirect after form Submit (CSR)
body: <p>Within a SharePoint form overriden by CSR (Client Side Rendering).</p>
  
  <p>I tried adding a new button which does pretty much the same as the Save button except that it redirects to another form with given parameters.</p>
  
  <p>The thing is, the redirection does not work.
  I tried redirecting by changing the "action" property of the form but it doesn't seem to be taken in count.</p>
  
  <p>Here is the new button :
  <code>&lt;input id="custom_addLine" type="button" name="custom_addLine" value="+" class="ms-ButtonHeightWidth"&gt;</code></p>
  
  <p>Here is the function called by the button and the addLine method following :</p>
  
  <pre><code>$('#custom_addLine').click(function(event){
      event.preventDefault();
      addLine(getQueryStringParameter('ID'));
  });
  
  
  function addLine(id) {
      if(!PreSaveItem()) {
          return false;
      }
      var actionUrl = "/Lists/PurchaseRequestLine/NewForm.aspx?PurchaseRequestID="+ id;
      var encodedActionUrl = encodeURIComponent(actionUrl);
  
      var newFormAction = location.pathname + '?Source=' + encodedActionUrl;
      $('#aspnetForm').attr('action',newFormAction);
  
      if(SPClientForms.ClientFormManager.SubmitClientForm('WPQ1')){
          return false;
      }
      WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('custom_addLine', "", true, "", "", false, true));
  }
  </code></pre>
  
  <p>getQueryStringParameter is a custom made function to retrieve parameters from URI (which works).</p>
  
  <p>The tricky part is that I want to preserve the default action URI in case the original Save button is clicked on, which is why action parameter is modified on the fly.</p>