Generating Forms for WebCRM Activities

The features described here are an optional part of the Rails Connector up to version 6.9.1. If you wish to continue to use these features in a later version of the Rails Connector, you can find the corresponding source code in a Git-repository.

If the Rails Connector has been connected to the WebCRM, i.e. if the CRM Connector has been installed and activated, you can have your Rails application generate forms based on CRM activities. When the website visitor submits such a form, the Rails Connector creates an activity from it and passes this activity to the CRM. Thus, forms for customer requests, for event registration, and other tasks can be automatically created and are maintenance-free. The corresponding activities created in the WebCRM can be edited conveniently, or used for other purposes, e.g. for sending e-mails.

To create pages with such generated forms in the editorial system, you only require a file format named CrmForm and a CMS file based on this format. Since a view is provided for this format, your Rails application will then generate a form for the contact form activity type when the CMS file is delivered.

Technical Details and Refinement Options

The Rails application uses the supplied CrmFormController controller to deliver the CMS file based on the CrmForm format. In the view that belongs to this controller, the CrmFormHelper is used for generating the form fields.

The CrmFormController inherits from DefaultCrmFormController. The latter has methods that can be overridden to change the default settings of the form to be created โ€“ e.g. the activity kind to be used (activity_kind).

The activity kind โ€“ the default is contact form โ€“ determines the form fields the CrmFormHelper generates, as well as the type of activity it creates in the WebCRM when the form is submitted. The helper generates form fields for all custom fields of the activity kind and, optionally, a form field for the activity title. By means of a callback (allow_custom_attribute?), the creation of a form field for a custom field can be suppressed.

To create form pages with a different layout in the CMS, you can create and use individual formats as alternatives or complementary to CrmForm. If, for example, you would like to deliver an event registration form using you individual CrmEventForm format, you only need to define the CrmEventFormController class as a subclass of RailsConnector::DefaultCrmFormController in your Rails application. To change the behavior of your CrmEventFormController, override its methods. For details on creating and extending new controllers, please refer to sections Dedicated Controllers for Specific CMS File Formats and Customizing the Rails Connector.

You can now design the page by editing the view associated with the new controller subclass. In this view, the form fields can be generated using the CrmFormHelper.

  • For further information about form generation, please refer to the supplied RDoc documentation for the DefaultCrmFormController.