What this solution does
The module simplifies and accelerates the creation of contact forms by moving all settings to component parameters. This solution is suitable for the Start edition and other versions when a simple form is needed on a page without lengthy configuration or assembly in the admin panel. The module includes support for Composite.
After installation, the custom.form component appears in the /bitrix/components/abcwww/ folder. It can be connected on a page manually or via the visual editor.
Form processing in the public part uses native JavaScript, so jQuery is not required. Multiple components can be placed on a single page, but each form must have a unique value specified in the 'Form Name' parameter.
The component allows creating a customizable contact form from a set of predefined fields. Settings provide options to select specific fields, reorder them, and mark them as required. Reserved names for standard fields are: CF_NAME, CF_PHONE, CF_EMAIL, and CF_COMMENT.
Additional fields are created using the name attribute. The field name and its display label are defined using the == separator (example: COMPANY==Company). The CF_ prefix is added automatically, so it should not be entered in the settings. User-defined field names must not duplicate the reserved standard names.
The comment field can be included in the general list and sorted with other fields. An option also exists to force the comment field to appear at the end of the form after all other text fields, ignoring the general sorting order.
File upload support is available with configurable validation for file types and maximum file size. The default name for the file field is CF_FILE. The default allowed file type is jpg.
During server-side processing, all form fields are escaped. Additional validation is applied to the phone and email fields. A JavaScript input mask for phone numbers is included. Bootstrap 5 styling is enabled by default.
Upon form submission, a CSRF token check is performed.
Anti-spam
Component settings allow enabling additional anti-spam protection that verifies the presence of working JavaScript in the user's browser and implements a comparison of an arbitrary control string on both the server and client sides.
Note: If the site template fails to include Bitrix core JavaScript files for any reason (specifically, if the $APPLICATION->ShowHead() method is not called in header.php), the anti-spam feature will function incorrectly. In this case, the corresponding checkbox in the component settings must be disabled.
Email Sending
A setting is available to enable email sending. Upon module installation, a mail event named ABCWWW_CUSTOM_FORM_FILLING is automatically created with an attached template, though a custom event may be specified. The component settings include a recipient field; the specified email is captured by the mail template using the #EMAIL_TO# macro (the #EMAIL_TO# macro is set by default in the preinstalled template).
Form Data Saving
Form data is saved.
Submitted form data is saved to a selected information block. The list of submitted fields is stored in the 'Announcement Description' field. To save uploaded files to the information block, create a file-type property and specify its symbolic code in the 'Information block property code for file saving' setting.
General iT can handle the implementation of “Configurable feedback form”, from installation to configuration and compatibility checks.