Sacha Trauwaen’s OpenForm is a module for DNN which is used for adding forms to a page.
It requires that the OpenContent module is installed first. The configuration is based on AlpacaJS.
Official documentation
Creating a new form
- Browse to the page which will hold the form and switch to edit mode
- Add a module
- Choose OpenForm
- Click Template Exchange
- Under Action, choose Copy Template
- Under From Template, choose an existing form (e.g. “Site:Contact”)
- Under To New Name, type the name of the new form (e.g. “Further Information Request”)
- Press Copy
- When you see Copy Successful, close the modal box and wait for the page to refresh
- Under Choose a template, choose Site:Whatever-you-just-called-it and wait for the page to refresh
- Click Template Settings
- Here you can:
- Set the Message after Submit that appears after the user successfully sends the form
- Add Email Notifications (see section below)
- Add other things (Tracking script / reCaptcha keys)
- Click Save
- Hover the module, open the Pencil menu and choose Form Builder
- Add your fields (see section below) and click Save
Form Builder
- Edit the page
- Hover the module, open the Pencil menu and choose Form Builder
- Give it a moment to load the left column, it can be a bit slow
From here you can add and remove items to the form. The left column shows the form builder, while the right shows a preview (albeit using plain bootstrap styles, so it’s not a true WYSIWYG).
- To add a control, click the Plus icon
- To remove a control, click the Minus icon
- To move a control up, click the up arrow
- To move a control down, click the down arrow
- To edit a control, click its name.
- From here, set the field name (no spaces or special characters)
- The type
- The Label, which will appear on the screen
- Required
- Advanced (default value, helper text, placeholder text, position if this is a multi-column form)
- Values (if this is a drop-down, radio buttons, or multi-select checkboxes)
- Dependencies (this control can be dependent on the value of other controls)
- Save or Cancel your changes
Note: It’s a good idea to press Save often, as it can occasionally get confused when moving new un-named controls up and down.
Form Settings
You can reach the form settings (for email notifications, etc.) by:
- Edit the page
- Hover the module, open the Pencil menu and choose Form Settings
Message after submit
You have a WYSIWYG editor to control the content shown after the form is submitted. To include form data in the message, you can use special tokens.
e.g. If your form contains fields named name and email, put this into the WYSIWYG:
Thanks {{ name }}, your email address is {{ email }}.
Email notifications
To make it send an email notification, you need to:
- Edit the page
- Pencil > Form Settings
- Add an email notification
Note: If the emails start failing, you can look at the Admin Logs in the PersonaBar.
The message uses a WYSIWYG to allow you to customise the HTML email you send back. You can use the same tokens as the Message After Submit to customise it, e.g.
Thanks {{ name }}, your email address is {{ email }}.
There is also a special {{{ FormData }}}
token, which outputs all of the data submitted. See https://openform.readme.io/docs/getting-started#section-email-messages-and-user-feedback
You can add multiple email notifications. This means you can send a notification back to the person who filled in the form another to the staff members who need to receive the information, and yet another to a CRM system.
Pre-filling the form with querystring data
You can use Javascript to pre-fill the form with data from the querystring. See https://openform.readme.io/docs/prefill-form-with-query-parameters for an example.
Pre-filling the form with user data
If the current user is logged in, you can pre-fill the form with their profile information. Make sure you use the following field names in your form:
Username
FirstName
LastName
Email
DisplayName
Telephone
Street
City
Country
Viewing form submissions
As well as being emailed out, all form submissions are stored in the database. If you have admin or super user access, you can view them by:
- Edit the page
- Hover the module, open the Pencil menu and choose Submissions
From there you can download the data in Excel format.
If you have superuser permissions, you can get to the raw JSON data:
- Edit the page
- Hover the module, open the Pencil menu and choose Edit Raw Data
At the time of writing, you cannot delete form submission data. (Jan 2020: I believe a subsequent release has now added this feature.)
Advanced features
Certain features can only be reached by directly editing the config files. For instance, some features (such as multi-page forms) cannot be added using the Form Builder. There is also the ability to use custom CSS and Javascript on the module, and a C#/Razor post-submission message which can do more than the regular submission message (with full access to the DNN API).
If you have Super User access, you can get to these by:
- Edit the page
- Hover the module, open the Pencil menu and choose Edit Template Files
If you’re developing a new form on your development machine, you may find it easier to find the files on the file system. They’re stored in:
[path to site]\Portals\[portal id]\OpenForm\Templates
So on my dev machine, where I’ve used nvQuickSite to install DNN, they’re here:
C:\Websites\sesame\
And on an Azure App Service, they’re likely to be under:
site\wwwroot\