OpenForm

The OpenForm Developer Hub

Welcome to the OpenForm developer hub.
OpenForm is a DNN module to create end users forms (Bootstrap 3) like contact, register, etc.

Get Started    Guides

Prefill form with query parameters

$(document).on("postRender.openform", function (event, control, moduleid, sf ) {
  var title = control.childrenByPropertyId["Sujet"];
  if(title){
    var sujet = getParameterByName('sujet');
    title.setValue(sujet);
  }
});

function getParameterByName(name, url) {
  if (!url) url = window.location.href;
  name = name.replace(/[\[\]]/g, "\\$&");
  var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
      results = regex.exec(url);
  if (!results) return null;
  if (!results[2]) return '';
  return decodeURIComponent(results[2].replace(/\+/g, " "));
}