Download the PHP package pstaender/silverstripe-customformpage without Composer
On this page you can find all versions of the php package pstaender/silverstripe-customformpage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pstaender/silverstripe-customformpage
More information about pstaender/silverstripe-customformpage
Files in pstaender/silverstripe-customformpage
Package silverstripe-customformpage
Short Description Define custom form fields via text input in your CMS
License MIT
Homepage https://github.com/pstaender/silverstripe-customformpage
Informations about the package silverstripe-customformpage
Custom Forms with SilverStripe
Define you custom form fields in your created CustomFormPage
with this straight forward syntax:
You can use as many form fields as you like.
Requirements
- SilverStripe 4+
Arguments
The following arguments are listed separated by |
in each {{ }}
form field block (sequence of arguments is not arbitrary):
- Name: String as CamelCase describing the name of your field; e.g.:
Email
,FirstName
…- the field is required, if ends with
*
; e.g.:Email *
- the field is required, if ends with
- Title: String as title, can contain every character except the
|
seperator; e.g.Your eMail:
- Class of Field: Can be every existing field class, without the
Field
appendix; e.g.:Text
,Textarea
,Email
,Dropdown
… - (assoc.) Array as option for the field
- optional
- must be JSON
- required for DropDownField for instance
Usage in Templates
You can access the form via $CustomForm
:
Comments and HTML tags
You can use comments #
and using html tags. HTML tags will be converted to SilverStripe LiteralFields:
Exclude Fields in form submission
You can explicitly prevent fields to be written in the submission. Just define them in your config:
Template variables
You can check $FormWasSuccessfullySended
and $FormWasSubmitted
in your template.
License
(C) 2017 by Philipp Staender, MIT Licence