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 String Parameters

You can pass Query String parameters to the Form to pre fill fields. This can be used to, for instance, pre-select a value by changing the url with which you send users to the page containing the Form.

$(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, " "));
}

Updated 2 years ago

Prefill Form with Query String Parameters


You can pass Query String parameters to the Form to pre fill fields. This can be used to, for instance, pre-select a value by changing the url with which you send users to the page containing the Form.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.