thewebmen / silverstripe-formbuilder
Silverstripe formbuilder to create forms in the cms
Installs: 3 058
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 12
Forks: 0
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- silverstripe/cms: ^4.0@dev
- silverstripe/vendor-plugin: ^1.0
Requires (Dev)
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2024-10-29 04:53:26 UTC
README
Introduction
Create basic forms in the CMS this module is intendended as light weight variant of the https://github.com/silverstripe/silverstripe-userforms module
Requirements
- SilverStripe CMS ^4.0
Installation
composer require "thewebmen/silverstripe-formbuilder" "dev-master"
Then add the "TheWebmen\Formbuilder\Extensions\FormbuilderExtension" extension the desired page type.
Custom after form handling
A form message is displayed after a successful form submission you can add custom logic to successful submissions by adding a method called "handleFormbuilderForm" to the page with the formbuilder extension, this method receives the form, the data and the submission.
public function handleFormbuilderForm($form, $data, $submission){
//Your logic here
}
This can be used to redirect users to a success page, this method is called after saving the submission and sending the emails.
Spam protection
If the https://github.com/silverstripe/silverstripe-spamprotection module is installed then the form will add a spam protection field automatically
The ModelDropdownfieldField type
There has been added a new input type called "Model Dropdownfield" which gives you the ability to fill a dropdown based on a dataobject model. One of the abilities you'll gain while using this input type, is the ability to link two dropdown/select items (eg. a province dropdown that updates another dropdown with cities from the selected province).
You can configure a field like this:
TheWebmen\Formbuilder\Fields\ModelDropdownField:
models:
- DataObjects\ModelDropdown\Provinces:
class: 'DataObjects\ModelDropdown\Provinces'
key: 'ID'
value: 'Name'
relation:
relation: 'Locations'
title: 'Vestiging'
linked_by: 'ProvinceID'
class: 'DataObjects\ModelDropdown\Locations'
key: 'Code'
value: 'Name'