Define custom form fields via text input in your CMS
Define you custom form fields in your created CustomFormPage
with this straight forward syntax:
{{ FieldName | My Field: | Dropdown | { "Option1": "Foo", "Option2": "Bar" } }}
{{ FieldName * | My Required Field: | Textarea }}
{{ Captcha | | Recaptcha }}
You can use as many form fields as you like.
The following arguments are listed separated by |
in each {{ }}
form field block (sequence of arguments is not arbitrary):
Email
, FirstName
â¦*
; e.g.: Email *
|
seperator; e.g. Your eMail:
Field
appendix; e.g.: Text
, Textarea
, Email
, Dropdown
â¦You can access the form via $CustomForm
:
<% with $MyCustomFormPage %>
<h1>$Title</h1>
$CustomForm
<% end_with %>
You can use comments #
and using html tags. HTML tags will be converted to SilverStripe LiteralFields:
# My advanced Poll Form Desctiption
{{ Email * | Your eMail (required): | Email }}
<hr />
<h2>Additional Information</h2>
# Description of something
{{ Age | Your age: | Dropdown | { "Under20": "younger or just 20", "Over20": "older than 20" } }}
You can explicitly prevent fields to be written in the submission. Just define them in your config:
CustomFormPageSubmission:
excludeParameters:
- Foo
- Bar
You can check $FormWasSuccessfullySended
and $FormWasSubmitted
in your template.
(C) 2017 by Philipp Staender, MIT Licence
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem