axllent/silverstripe-enquiry-page

Simple contact page with enquiry form

Installs: 1 406

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 4

Forks: 2

Open Issues: 0

Type:silverstripe-vendormodule

3.0.0 2023-08-04 06:49 UTC

README

This is a simple module to add an Enquiry Page pagetype to the CMS. The module uses optional JavaScript form validation, so no requirements for third-party JavaScript libraries (eg: jQuery). The enquiry form can be configured to add & order your own fields, including the following types:

  • Text (TextField/TextAreaField)
  • Email (EmailField)
  • Select (DropdownField), options configurable
  • Checkbox (CheckboxSetField), options configurable
  • Options (OptionsetField), options configurable
  • Readonly (HTMLReadonlyField), optional html text
  • HTML section (HTMLText)

Configuration options include:

  • Send email to
  • Send email from (the "reply to" will default to the first Email field in the form, or alternatively this value)
  • Email subject
  • Message once completed
  • BCC copy
  • Submit button text
  • Optional built-in captcha image

Captcha Image

A randomly-generated captcha image can be easily enabled in the form via the CMS. By default it will produce a 4-digit image 60x30px with an input field next to it. If you wish to change the height of the image (eg: to match bootstrap input styling), you can configure this in your YAML:

Axllent\EnquiryPage\EnquiryPage:
  captcha_img_height: 35

Please note that the height should be no less than 20 (else the numbers may not be displayed properly).

If you use web services that dynamically change the REMOTE_ADDR field (most notably CloudFlare) you can configure another field, e.g.:

Axllent\EnquiryPage\EnquiryPage:
  # Try $_SERVER['HTTP_CF_CONNECTING_IP'] (CloudFlare custom field) before
  # $_SERVER['REMOTE_ADDR'], so it will work with and without CloudFlare
  client_ip_fields:
    - HTTP_CF_CONNECTING_IP
    - REMOTE_ADDR

If required, you can disable the client IP retrieval entirely by unsetting that option.

JavaScript validation

If you wish to turn on the built-in JavaScript validation, then this can be added to your site's YAML config:

Axllent\EnquiryPage\EnquiryPage:
  js_validation: true

Requirements

Installation

composer require axllent/silverstripe-enquiry-page