Forms

This module enables non technical users to create and edit forms. The forms can be inserted into any HTML field using the insert object button in the toolbar of the HTML editor.

Form definition

The forms are defined in the forms module:

 forms_module

 

 The first time you go to the module, there is only one button. "New webform":

 forms_module2


When you add a new form, you're shown the following screen:

forms_module_new_form

 

Form settings

There are a lot of settings for the forms you define. From behaviour to how it looks; almost everything can be customized. The settings are split into different categories (tabs):

  • The "Web form" tab contains the basic settings and confirmation and notification settings.

  • The Settings tab contains a lot of detailed information on how to render the html.

  • The Templates tab contains the template code used to render the form. These templates can be overridden to get your desired look and functionality.

  • The Definitions tab contains the field definitions of the form.

 

Fields

 There are a number of different field types you can create when you have defined a form. 

If you switch to the "Fields" tab:

forms_module_new_form2

Click on the "Add new form field" button to add a new field. You get a dialog where you have to choose the field type. The types available are:

 form_field

If you select the "Text box" field type, you get the following:

form_field2

 

When you create new fields, they are listed on the left:

 form_field4

Preview

When you open a form, you can click the preview icon on the blade to preview and test your form without publishing it on any pages. Note that the styling and look might be different than what you'll see in a real web page, due to the fact that different css rules may apply to the fields. The preview is very plain.

form_preview

Inbox

The inbox displays the submissions of the current form. This is a copy of the content sent in an email to the notification email addresses. 

forms_inbox

 

You can click on any of the submissions to read them:

forms_inbox2

Using forms

Forms can be used inside the html editor in Relatude, and the forms can be rendered inside content without any programming required:

  1. First, click on the "Insert or edit object" button in the editor:
    forms_editor_insert

  2. In the dialog that opens, select the "Form" button:
    forms_editor_insert2

  3. That opens a dialog that lists all the forms in the current site. Select the one you want to show:
    forms_editor_insert3

  4. The inserted forms is rendered as a placeholder. The placeholder makes it easy to move the form around in the text content:
    forms_editor_insert4

For the visitor, the inserted form can look something like this:

 insert5insert5insert5

Rendering forms programmatically

The most common way of using forms have traditionally been to insert the forms in the editor. But with the popularity of modular page architecture, many new sites are composing pages using modules. On those situations, it is common to create a "Forms module", with a node parent relation on the module where you can select a form. In the code that renders the module, you can do the following to render a form: 

WebForm form = module.Form.Get();
string formHtml = form.GetFormHtml(httpContext.Request.Params);