mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
DOC Linting
This commit is contained in:
parent
045f6c0e57
commit
edfd0f5c06
1
.doclintrc
Normal file
1
.doclintrc
Normal file
@ -0,0 +1 @@
|
|||||||
|
docs/en/
|
@ -41,6 +41,7 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^9.6",
|
"phpunit/phpunit": "^9.6",
|
||||||
"squizlabs/php_codesniffer": "^3",
|
"squizlabs/php_codesniffer": "^3",
|
||||||
|
"silverstripe/documentation-lint": "^1",
|
||||||
"silverstripe/standards": "^1",
|
"silverstripe/standards": "^1",
|
||||||
"phpstan/extension-installer": "^1.3"
|
"phpstan/extension-installer": "^1.3"
|
||||||
},
|
},
|
||||||
@ -70,6 +71,11 @@
|
|||||||
"images"
|
"images"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"config": {
|
||||||
|
"allow-plugins": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"minimum-stability": "dev"
|
"minimum-stability": "dev"
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
|
---
|
||||||
|
title: Installation
|
||||||
|
---
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
Installation should be done using Composer:
|
Installation should be done using Composer:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
composer require silverstripe/userforms
|
composer require silverstripe/userforms
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -10,7 +14,7 @@ composer require silverstripe/userforms
|
|||||||
|
|
||||||
After installation, make sure you rebuild your database through `dev/build`.
|
After installation, make sure you rebuild your database through `dev/build`.
|
||||||
|
|
||||||
You should see a new page type in the CMS called 'User Defined Form'. This has a new 'Form' tab which has your form builder.
|
You should see a new page type in the CMS called "User Defined Form". This has a new "Form" tab which has your form builder.
|
||||||
|
|
||||||
### File uploads and security
|
### File uploads and security
|
||||||
|
|
||||||
@ -20,9 +24,9 @@ so they can be viewed later by CMS authors. Small files
|
|||||||
are also attached to the (optional) email notifications
|
are also attached to the (optional) email notifications
|
||||||
to any configured recipients.
|
to any configured recipients.
|
||||||
|
|
||||||
Allowed file extensions can be configured globally through `File.allowed_extensions`,
|
Allowed file extensions can be configured globally through [`File.allowed_extensions`](api:SilverStripe\Assets\File->allowed_extensions),
|
||||||
and default to a safe set of files (e.g. disallowing `*.php` uploads).
|
and default to a safe set of files (e.g. disallowing `*.php` uploads).
|
||||||
You can define further exclusions through the `EditableFileField.allowed_extensions_blacklist`
|
You can define further exclusions through the [`EditableFileField.allowed_extensions_blacklist`](api:SilverStripe\UserForms\Model\EditableFormField\EditableFileField->allowed_extensions_blacklist)
|
||||||
configuration setting.
|
configuration setting.
|
||||||
|
|
||||||
The allowed upload size can be set in the CMS as long as it doesn't exceed the PHP configuration
|
The allowed upload size can be set in the CMS as long as it doesn't exceed the PHP configuration
|
||||||
@ -30,7 +34,7 @@ for this website (the smaller value of `upload_max_filesize` or `post_max_size`)
|
|||||||
|
|
||||||
### Securing uploaded files
|
### Securing uploaded files
|
||||||
|
|
||||||
By adding a File Upload Field to your user form you can allow your website users to upload files, which will be stored in a user-defined folder in your SilverStripe system. You can access these files via the "Submissions" tab, or from the "Files" area in the admin interface.
|
By adding a File Upload Field to your user form you can allow your website users to upload files, which will be stored in a user-defined folder in your Silverstripe CMS system. You can access these files via the "Submissions" tab, or from the "Files" area in the admin interface.
|
||||||
|
|
||||||
Please be aware that the responsibility of choosing a folder for files to be uploaded into is that of the CMS user. You can set the necessary "can view" permissions for the folder you create and/or choose via the "Files" section, then select that folder in the settings for the File Upload Field in your form.
|
Please be aware that the responsibility of choosing a folder for files to be uploaded into is that of the CMS user. You can set the necessary "can view" permissions for the folder you create and/or choose via the "Files" section, then select that folder in the settings for the File Upload Field in your form.
|
||||||
|
|
||||||
@ -44,18 +48,18 @@ In other cases, submissions could be expected to contain private data.
|
|||||||
|
|
||||||
If you want to use custom email templates set the following config option.
|
If you want to use custom email templates set the following config option.
|
||||||
|
|
||||||
```yaml
|
```yml
|
||||||
SilverStripe\UserForms\Model\UserDefinedForm:
|
SilverStripe\UserForms\Model\UserDefinedForm:
|
||||||
email_template_directory: mysite/templates/custom_userforms_emails/
|
email_template_directory: mysite/templates/custom_userforms_emails/
|
||||||
```
|
```
|
||||||
|
|
||||||
Any SilverStripe templates placed in your `email_template_directory` directory will be available for use with submission emails.
|
Any templates placed in your `email_template_directory` directory will be available for use with submission emails.
|
||||||
|
|
||||||
### Custom multi-step button text
|
### Custom multi-step button text
|
||||||
|
|
||||||
If you want to change the button text when using the Multi-Step/Page Break feature, simply add the following to your `config.yml`:
|
If you want to change the button text when using the Multi-Step/Page Break feature, simply add the following to your `config.yml`:
|
||||||
|
|
||||||
```yaml
|
```yml
|
||||||
SilverStripe\UserForms\Form\UserForm:
|
SilverStripe\UserForms\Form\UserForm:
|
||||||
button_text: 'Your Text Here'
|
button_text: 'Your Text Here'
|
||||||
```
|
```
|
@ -1,10 +1,14 @@
|
|||||||
|
---
|
||||||
|
title: Creating custom fields
|
||||||
|
---
|
||||||
|
|
||||||
# Creating custom fields
|
# Creating custom fields
|
||||||
|
|
||||||
To create and use your own custom fields, depending on what you want to accomplish, you may need to create two
|
To create and use your own custom fields, depending on what you want to accomplish, you may need to create two
|
||||||
new classes subclassed from the following:
|
new classes subclassed from the following:
|
||||||
|
|
||||||
- `EditableFormField` - this Field represents what will be seen/used in the CMS userforms interface
|
- [`EditableFormField`](api:SilverStripe\UserForms\Model\EditableFormField) - this Field represents what will be seen/used in the CMS userforms interface
|
||||||
- `FormField` - this Field represents what will be seen/used in the frontend user form when the above field has been
|
- [`FormField`](api:SilverStripe\Forms\FormField) - this Field represents what will be seen/used in the frontend user form when the above field has been
|
||||||
added
|
added
|
||||||
|
|
||||||
## How (without the "why")
|
## How (without the "why")
|
||||||
@ -13,9 +17,9 @@ You need to create your own subclass of `EditableFormField` (the field which wil
|
|||||||
implement the method `getFormField()`, which will need to return an instantiated `FormField` to be used in the
|
implement the method `getFormField()`, which will need to return an instantiated `FormField` to be used in the
|
||||||
frontend form.
|
frontend form.
|
||||||
|
|
||||||
`EditableTextField` and `TextField` are two existing classes and probably the best example to look in to.
|
[`EditableTextField`](api:SilverStripe\UserForms\Model\EditableFormField\EditableTextField) and [`TextField`](api:SilverStripe\Forms\TextField) are two existing classes and probably the best example to look in to.
|
||||||
|
|
||||||
## Why two different Fields?
|
## Why two different fields?
|
||||||
|
|
||||||
Consider the following example (`EditableTextField` and `TextField`).
|
Consider the following example (`EditableTextField` and `TextField`).
|
||||||
|
|
@ -1,21 +1,26 @@
|
|||||||
|
---
|
||||||
|
title: Troubleshooting
|
||||||
|
---
|
||||||
|
|
||||||
# Troubleshooting
|
# Troubleshooting
|
||||||
|
|
||||||
Check the below if you have any issues during installation or use
|
Check the below if you have any issues during installation or use
|
||||||
|
|
||||||
## Installation Issues
|
## Installation issues
|
||||||
|
|
||||||
After installation make sure you have done a `dev/build` you may also need to flush the admin view by appending
|
After installation make sure you have done a `dev/build` you may also need to flush the admin view by appending
|
||||||
`?flush=1` to the URL, e.g. `http://yoursite.com/admin?flush=1`
|
`?flush=1` to the URL, e.g. `https://example.com/admin?flush=1`
|
||||||
|
|
||||||
## Checkbox or Radio group custom messages not showing
|
## Checkbox or radio group custom messages not showing
|
||||||
|
|
||||||
If your project has a custom template for `UserFormsCheckboxSetField.ss` or `UserFormsOptionSetField.ss`, then you will need to ensure they include `$Top.getValidationAttributesHTML().RAW`. See
|
If your project has a custom template for `UserFormsCheckboxSetField.ss` or `UserFormsOptionSetField.ss`, then you will need to ensure they include `$Top.getValidationAttributesHTML().RAW`. See
|
||||||
* [UserFormsCheckboxSetField.ss](../../templates/SilverStripe/UserForms/FormField/UserFormsCheckboxSetField.ss)
|
|
||||||
* [UserFormsOptionSetField.ss](../../templates/SilverStripe/UserForms/FormField/UserFormsOptionSetField.ss)
|
|
||||||
|
|
||||||
## UserForms EditableFormField Column Clean task
|
- [UserFormsCheckboxSetField.ss](../../templates/SilverStripe/UserForms/FormField/UserFormsCheckboxSetField.ss)
|
||||||
|
- [UserFormsOptionSetField.ss](../../templates/SilverStripe/UserForms/FormField/UserFormsOptionSetField.ss)
|
||||||
|
|
||||||
This task is used to clear unused columns from EditableFormField database tables.
|
## UserForms `EditableFormField` column clean task
|
||||||
|
|
||||||
|
This [`UserFormsColumnCleanTask`](api:SilverStripe\UserForms\Task\UserFormsColumnCleanTask) task is used to clear unused columns from EditableFormField database tables.
|
||||||
|
|
||||||
The reason to clear these columns is because having surplus forms can break form saving.
|
The reason to clear these columns is because having surplus forms can break form saving.
|
||||||
|
|
||||||
@ -23,7 +28,7 @@ Currently it only supports MySQL and when it is run it queries the EditableFormF
|
|||||||
it then grabs the columns for the live database. It will create a backup of the table and then remove any columns that
|
it then grabs the columns for the live database. It will create a backup of the table and then remove any columns that
|
||||||
are surplus.
|
are surplus.
|
||||||
|
|
||||||
To run the task, log in as an administrator and go to to http://yoursite/dev/tasks/UserFormsColumnCleanTask in your browser, or run `sake dev/tasks/UserFormsColumnCleanTask` from the command line.
|
To run the task, log in as an administrator and go to `https://example.com/dev/tasks/UserFormsColumnCleanTask` in your browser, or run `sake dev/tasks/UserFormsColumnCleanTask` from the command line.
|
||||||
|
|
||||||
## My CSV export times out or runs out of memory
|
## My CSV export times out or runs out of memory
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
# Compiling front-end files
|
|
||||||
|
|
||||||
UserForms stylesheets are written in SASS and JavaScript follows ES6 syntax. Both are compiled with Webpack into distributable, minified files.
|
|
||||||
|
|
||||||
To get started, you will first need NodeJS, NPM, Webpack and Yarn installed. For more information on this process, [see "Build Tooling" in the SilverStripe documentation](https://docs.silverstripe.org/en/4/contributing/build_tooling/).
|
|
||||||
|
|
||||||
## Watching for changes
|
|
||||||
|
|
||||||
As you make changes to SASS or JavaScript, you can ask Yarn to watch and rebuild the deltas as their are saved:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn watch
|
|
||||||
```
|
|
||||||
|
|
||||||
This will not minify the dist files.
|
|
||||||
|
|
||||||
## Compile assets for production
|
|
||||||
|
|
||||||
When you're happy with your changes and are ready to make a pull request you should run a "build" command to compile and minify everything:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn build
|
|
||||||
```
|
|
@ -1,3 +1,7 @@
|
|||||||
|
---
|
||||||
|
title: UserForms
|
||||||
|
---
|
||||||
|
|
||||||
# UserForms
|
# UserForms
|
||||||
|
|
||||||
UserForms enables CMS users to create dynamic forms via a drag and drop interface
|
UserForms enables CMS users to create dynamic forms via a drag and drop interface
|
||||||
@ -5,22 +9,13 @@ and without getting involved in any PHP code.
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Construct a form using all major form fields (text, email, dropdown, radio, checkbox..)
|
- Construct a form using all major form fields (text, email, dropdown, radio, checkbox..)
|
||||||
* Ability to extend userforms from other modules to provide extra fields.
|
- Ability to extend userforms from other modules to provide extra fields.
|
||||||
* Ability to email multiple people the form submission
|
- Ability to email multiple people the form submission
|
||||||
* Custom email templates
|
- Custom email templates
|
||||||
* View submitted submissions and export them to CSV
|
- View submitted submissions and export them to CSV
|
||||||
* Define custom error messages and validation settings
|
- Define custom error messages and validation settings
|
||||||
* Optionally display and hide fields using javascript based on users input
|
- Optionally display and hide fields using JavaScript based on users input
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
* [Installation instructions](installation.md)
|
|
||||||
* [Troubleshooting](troubleshooting.md)
|
|
||||||
* [User Documentation](userguide/index.md)
|
|
||||||
* [Compiling Front-End Files](compiling-front-end-files.md)
|
|
||||||
* [Creating Custom Fields](creating-custom-fields.md)
|
|
||||||
* [Upgrading to SilverStripe 4](upgrading.md)
|
|
||||||
|
|
||||||
## Thanks
|
## Thanks
|
||||||
|
|
||||||
@ -29,3 +24,5 @@ testers, clients who use the module and everyone that submits new features.
|
|||||||
|
|
||||||
A big thanks goes out to [Jan Düsedau](http://eformation.de) for drawing
|
A big thanks goes out to [Jan Düsedau](http://eformation.de) for drawing
|
||||||
the custom icon set for the form fields.
|
the custom icon set for the form fields.
|
||||||
|
|
||||||
|
[CHILDREN includeFolders]
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
# Upgrading to SilverStripe 4
|
|
||||||
|
|
||||||
## API changes
|
|
||||||
|
|
||||||
The SilverStripe 4 compatible version of UserForms (5.x) introduces some breaking API changes:
|
|
||||||
|
|
||||||
* Namespaces are added. Please use the SilverStripe upgrader to automatically update references in your code.
|
|
||||||
* Previously deprecated code from UserForms 4.x has been removed:
|
|
||||||
* `EditableFormField::getSettings()`
|
|
||||||
* `EditableFormField::setSettings()`
|
|
||||||
* `EditableFormField::setSetting()`
|
|
||||||
* `EditableFormField::getSetting()`
|
|
||||||
* `EditableFormField::getFieldName()`
|
|
||||||
* `EditableFormField::getSettingName()`
|
|
||||||
* `EditableFormField::migrateSettings()`
|
|
||||||
|
|
||||||
The frontend JavaScript and SASS assets have been converted from Compass to
|
|
||||||
[Webpack](https://github.com/silverstripe/webpack-config), and now live in the `client/` folder. Please
|
|
||||||
[see here](https://docs.silverstripe.org/en/4/contributing/build_tooling/) for information on this build toolchain.
|
|
||||||
|
|
||||||
## Data migration
|
|
||||||
|
|
||||||
UserForms 5.0 includes a legacy class name remapping configuration file (legacy.yml) as well as `$table_name`
|
|
||||||
configuration for every DataObject to ensure that existing data in your database will remain unchanged. This
|
|
||||||
should help to ensure that your upgrade process from UserForms 4.x on SilverStripe 3 is as seamless as possible.
|
|
||||||
|
|
||||||
## Secure assets for EditableFileField
|
|
||||||
|
|
||||||
In SilverStripe 3 with UserForms you could install the SecureAssets module to allow the ability to set permissions
|
|
||||||
on folders that files can be uploaded into via your custom forms.
|
|
||||||
|
|
||||||
In SilverStripe 4 this functionality is built into the core assets module, so the SecureAssets module is no longer
|
|
||||||
required, and the SecureEditableFileField extension has been removed.
|
|
||||||
|
|
||||||
**Important:** While you shouldn't have to do anything in terms of folder permissions during this upgrade, we highly
|
|
||||||
recommend that you sanity check any secure folders you have in your website to ensure that the permissions are still
|
|
||||||
locked down before going live.
|
|
||||||
|
|
||||||
Please be aware that if you had SecureAssets installed in SilverStripe 3 with UserForms your EditableFileField folder
|
|
||||||
choice would be made secure by default, whereas in SilverStripe 4 this is up to the user to configure at their
|
|
||||||
discretion.
|
|
@ -18,10 +18,8 @@ drop-down menu will show up. Select "User Defined Form" Then hit the "Go" button
|
|||||||
|
|
||||||
You will notice that a new page has been created, with the name of "New User Defined Form." You will be taken to edit the page once you click "Create."
|
You will notice that a new page has been created, with the name of "New User Defined Form." You will be taken to edit the page once you click "Create."
|
||||||
|
|
||||||
<div class="note" markdown="1">
|
> [!NOTE]
|
||||||
Don't worry if you create your page in the "wrong" place. Pages can be moved and re-ordered
|
> Don't worry if you create your page in the "wrong" place. Pages can be moved and re-ordered easily.
|
||||||
easily.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## Combining forms and content
|
## Combining forms and content
|
||||||
|
|
||||||
@ -31,10 +29,10 @@ however. You will notice in a newly created form page, there is some text in the
|
|||||||
of the editing menu to begin with: "$UserDefinedForm"
|
of the editing menu to begin with: "$UserDefinedForm"
|
||||||
|
|
||||||
The purpose of this little block of text is to tell the website where in the page you
|
The purpose of this little block of text is to tell the website where in the page you
|
||||||
would like to put the form. The form will appear on the website wherever the "$UserDefinedForm"
|
would like to put the form. The form will appear on the website wherever the `$UserDefinedForm`
|
||||||
appears in the editing pane, whether it is before text, after text, inside a table, etc.
|
appears in the editing pane, whether it is before text, after text, inside a table, etc.
|
||||||
|
|
||||||
If $UserDefinedForm is deleted by accident (or on purpose), SilverStripe automatically
|
If $UserDefinedForm is deleted by accident (or on purpose), Silverstripe CMS automatically
|
||||||
puts the form at the end of all the content.
|
puts the form at the end of all the content.
|
||||||
|
|
||||||
![Form in content](_images/form-in-content.png)
|
![Form in content](_images/form-in-content.png)
|
||||||
@ -67,3 +65,10 @@ Each message links to it's corresponding field so users can easily make the requ
|
|||||||
The 'Configuration' tab has a number of options used for customising your form's behaviour and appearance.
|
The 'Configuration' tab has a number of options used for customising your form's behaviour and appearance.
|
||||||
|
|
||||||
![Configuration](_images/userforms-config.png)
|
![Configuration](_images/userforms-config.png)
|
||||||
|
|
||||||
|
## Creating a multi-page form
|
||||||
|
|
||||||
|
To create a multi-page form, simply click the "Add Page Break" button.
|
||||||
|
This will create a page break field which is used to create a new page in the form. You can drag and drop this page break to separate form fields at the desired location.
|
||||||
|
|
||||||
|
![Multi-page forms](_images/multi-page-forms.png)
|
@ -4,7 +4,7 @@ title: Field types
|
|||||||
|
|
||||||
# Field types
|
# Field types
|
||||||
|
|
||||||
## Checkbox Field
|
## Checkbox field
|
||||||
|
|
||||||
Selecting a checkbox field adds a single checkbox to a form, along with a place to
|
Selecting a checkbox field adds a single checkbox to a form, along with a place to
|
||||||
store a label for that checkbox. This is useful for getting information that has a
|
store a label for that checkbox. This is useful for getting information that has a
|
||||||
@ -13,7 +13,7 @@ understood the Terms and Conditions?"
|
|||||||
|
|
||||||
Marking this field as required will require it to be checked.
|
Marking this field as required will require it to be checked.
|
||||||
|
|
||||||
## Checkbox Group
|
## Checkbox group
|
||||||
|
|
||||||
Selecting a checkbox group adds a field for multiple checkboxes to a form, along with a
|
Selecting a checkbox group adds a field for multiple checkboxes to a form, along with a
|
||||||
place to store a label for the group. This is useful for getting information that has
|
place to store a label for the group. This is useful for getting information that has
|
||||||
@ -23,31 +23,31 @@ options" link to add user-selectable options.
|
|||||||
|
|
||||||
Marking this field as required will require at least one option to be checked.
|
Marking this field as required will require at least one option to be checked.
|
||||||
|
|
||||||
## Country Dropdown
|
## Country dropdown
|
||||||
|
|
||||||
A list of all countries drawn from the internal list of known countries.
|
A list of all countries drawn from the internal list of known countries.
|
||||||
|
|
||||||
## Date Field
|
## Date field
|
||||||
|
|
||||||
Selecting a date field adds a field for a date in a form. The time of day is not selectable, however.
|
Selecting a date field adds a field for a date in a form. The time of day is not selectable, however.
|
||||||
|
|
||||||
If your theme enables it, a date picker popup will be displayed to the user on the frontend.
|
If your theme enables it, a date picker popup will be displayed to the user on the frontend.
|
||||||
|
|
||||||
## Dropdown Field
|
## Dropdown field
|
||||||
|
|
||||||
Selecting a drop-down field adds a dropdown field to a form. This is useful for getting
|
Selecting a drop-down field adds a dropdown field to a form. This is useful for getting
|
||||||
information that has only one answer among several discrete choices, for example,
|
information that has only one answer among several discrete choices, for example,
|
||||||
"Which region do you live in?" or "What subject is your question about?" You will
|
"Which region do you live in?" or "What subject is your question about?" You will
|
||||||
need to click on the "Show options" link to add user-selectable options.
|
need to click on the "Show options" link to add user-selectable options.
|
||||||
|
|
||||||
## Email Field
|
## Email field
|
||||||
|
|
||||||
Selecting an Email field adds a textbox where an email address can be entered. Using the Email
|
Selecting an Email field adds a textbox where an email address can be entered. Using the Email
|
||||||
field to store email addresses instead of a normal text field allows you to use that email
|
field to store email addresses instead of a normal text field allows you to use that email
|
||||||
address in many automated tasks. For example, it allows the CMS to send reply email
|
address in many automated tasks. For example, it allows the CMS to send reply email
|
||||||
automatically when a form is filled out.
|
automatically when a form is filled out.
|
||||||
|
|
||||||
## File Upload Field
|
## File upload field
|
||||||
|
|
||||||
Selecting a File Upload Field adds a field where users can upload a file from their
|
Selecting a File Upload Field adds a field where users can upload a file from their
|
||||||
computers. This is useful for getting documents and media files.
|
computers. This is useful for getting documents and media files.
|
||||||
@ -63,7 +63,6 @@ You can set any permission requirements on the upload folder by finding it in th
|
|||||||
Only certain file extensions are considered safe for upload,
|
Only certain file extensions are considered safe for upload,
|
||||||
e.g. webserver script files will be denied but images will be allowed. The webserver environment also imposes a limit on file size by default.
|
e.g. webserver script files will be denied but images will be allowed. The webserver environment also imposes a limit on file size by default.
|
||||||
|
|
||||||
|
|
||||||
## Heading
|
## Heading
|
||||||
|
|
||||||
Selecting a Heading allows adds a place where you can put a heading for a form, or for
|
Selecting a Heading allows adds a place where you can put a heading for a form, or for
|
||||||
@ -73,7 +72,7 @@ the "Show options" link.
|
|||||||
If you do not check the "Hide from reports" checkbox then this field will be displayed
|
If you do not check the "Hide from reports" checkbox then this field will be displayed
|
||||||
in submission reports.
|
in submission reports.
|
||||||
|
|
||||||
## HTML Block
|
## HTML block
|
||||||
|
|
||||||
Selecting an HTML block allows you to add any HTML code you wish into your form.
|
Selecting an HTML block allows you to add any HTML code you wish into your form.
|
||||||
You can edit the HTML blog from the "Show options" link.
|
You can edit the HTML blog from the "Show options" link.
|
||||||
@ -88,7 +87,7 @@ add your own headings within the content of this field.
|
|||||||
Note: Take care not to allow input from unauthorised sources or users, as custom script
|
Note: Take care not to allow input from unauthorised sources or users, as custom script
|
||||||
or code could be injected into your form.
|
or code could be injected into your form.
|
||||||
|
|
||||||
## Member List Field
|
## Member list field
|
||||||
|
|
||||||
Selecting a Member List Field adds a dropdown field which includes various groups of website
|
Selecting a Member List Field adds a dropdown field which includes various groups of website
|
||||||
members (such as administrators or forum members) to the form. You can choose which group
|
members (such as administrators or forum members) to the form. You can choose which group
|
||||||
@ -97,11 +96,11 @@ of members from the "Show Options" link.
|
|||||||
Note: Take care that you do not expose confidential or personal information about your CMS
|
Note: Take care that you do not expose confidential or personal information about your CMS
|
||||||
or front end users as these names will become publicly visible.
|
or front end users as these names will become publicly visible.
|
||||||
|
|
||||||
## Numeric Field
|
## Numeric field
|
||||||
|
|
||||||
A basic text field that will only accept numeric values (numbers and decimals only).
|
A basic text field that will only accept numeric values (numbers and decimals only).
|
||||||
|
|
||||||
## Radio Field
|
## Radio field
|
||||||
|
|
||||||
Selecting a Radio field adds a field filed with "Radio button" options to a form.
|
Selecting a Radio field adds a field filed with "Radio button" options to a form.
|
||||||
Radio buttons are similar to checkboxes, except that only one button in a radio
|
Radio buttons are similar to checkboxes, except that only one button in a radio
|
||||||
@ -113,19 +112,19 @@ For example, a dropdown field may have one or two-word inputs, while a radio
|
|||||||
button may have choices that are paragraphs in length. You will need to click
|
button may have choices that are paragraphs in length. You will need to click
|
||||||
on the "Show options" link to add user-selectable options.
|
on the "Show options" link to add user-selectable options.
|
||||||
|
|
||||||
## Text Field
|
## Text field
|
||||||
|
|
||||||
Selecting a Text field adds a text field to the form. You can click on "Show options"
|
Selecting a Text field adds a text field to the form. You can click on "Show options"
|
||||||
to determine the size and the number of rows in a text field.
|
to determine the size and the number of rows in a text field.
|
||||||
|
|
||||||
**Put another way, if you'd like to create a question that...**
|
**Put another way, if you'd like to create a question that...**
|
||||||
|
|
||||||
* Has a yes or no answer - use [Checkbox Field](#checkbox-field).
|
- Has a yes or no answer - use [Checkbox Field](#checkbox-field).
|
||||||
* Has multiple possible answers, from a list of choices - use [Checkbox Group](#checkbox-group).
|
- Has multiple possible answers, from a list of choices - use [Checkbox Group](#checkbox-group).
|
||||||
* Has one answer, from a list of choices - use [Dropdown Field](#dropdown-field) (for short answers) or
|
- Has one answer, from a list of choices - use [Dropdown Field](#dropdown-field) (for short answers) or
|
||||||
[Radio Field](#radio-field) (for longer answers).
|
[Radio Field](#radio-field) (for longer answers).
|
||||||
* Requires a written answer - use [Text Field](#text-field).
|
- Requires a written answer - use [Text Field](#text-field).
|
||||||
|
|
||||||
**Or perhaps you'd like to add informational content to your form?**
|
**Or perhaps you'd like to add informational content to your form?**
|
||||||
|
|
||||||
* Use [HTML Block](#html-block), with the appropriate level [Heading](#heading).
|
- Use [HTML Block](#html-block), with the appropriate level [Heading](#heading).
|
@ -30,7 +30,7 @@ Simply insert the merge field into the email content, and the field's value will
|
|||||||
|
|
||||||
### Email details
|
### Email details
|
||||||
|
|
||||||
#### Email Subject
|
#### Email subject
|
||||||
|
|
||||||
The subject of the email, you can either type a custom subject here or select a field from the form to use as the email subject.
|
The subject of the email, you can either type a custom subject here or select a field from the form to use as the email subject.
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ This is the recipient's address where the email will be sent.
|
|||||||
|
|
||||||
#### Send email from
|
#### Send email from
|
||||||
|
|
||||||
This shows where the email was sent from, and will most likely need to be an email address on the same domain as your site. For example If your website is yoursite.com, the email address for this field should be something@yoursite.com.
|
This shows where the email was sent from, and will most likely need to be an email address on the same domain as your site. For example If your website is `example.com`, the email address for this field should be `something@example.com`.
|
||||||
|
|
||||||
#### Email for reply to
|
#### Email for reply to
|
||||||
|
|
||||||
@ -70,13 +70,12 @@ template can be selected to provide a standard formatted email to contain the ed
|
|||||||
|
|
||||||
The list of available templates can be controlled by specifying the folder for these template files in YAML config.
|
The list of available templates can be controlled by specifying the folder for these template files in YAML config.
|
||||||
|
|
||||||
|
```yml
|
||||||
```yaml
|
|
||||||
UserDefinedForm:
|
UserDefinedForm:
|
||||||
email_template_directory: mysite/templates/useremails/
|
email_template_directory: mysite/templates/useremails/
|
||||||
```
|
```
|
||||||
|
|
||||||
### Custom Rules
|
### Custom rules
|
||||||
|
|
||||||
In this section you can determine whether to send the email to the recipient based on the data in the form submission.
|
In this section you can determine whether to send the email to the recipient based on the data in the form submission.
|
||||||
|
|
||||||
@ -85,16 +84,16 @@ In this section you can determine whether to send the email to the recipient bas
|
|||||||
This decides whether to send the email based on two options
|
This decides whether to send the email based on two options
|
||||||
|
|
||||||
1. *All* conditions are true (Every single custom rule must be met in order to send the email)
|
1. *All* conditions are true (Every single custom rule must be met in order to send the email)
|
||||||
2. *Any* conditions are true (At least one of the custom rules must be met in order to send the email)
|
1. *Any* conditions are true (At least one of the custom rules must be met in order to send the email)
|
||||||
|
|
||||||
#### Adding a custom rule
|
#### Adding a custom rule
|
||||||
|
|
||||||
* Click 'Add' to add a custom sending rule.
|
- Click 'Add' to add a custom sending rule.
|
||||||
* Select the field which you want the custom rule to apply to
|
- Select the field which you want the custom rule to apply to
|
||||||
* Select the condition the field must follow
|
- Select the condition the field must follow
|
||||||
* enter for the condition (the 'is blank' and 'is not blank' conditions do not require any text)
|
- enter for the condition (the 'is blank' and 'is not blank' conditions do not require any text)
|
||||||
|
|
||||||
## File Upload Field
|
## File upload field
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> This functionality is specifically included in Silverstripe core functionality 4.6 and above,
|
> This functionality is specifically included in Silverstripe core functionality 4.6 and above,
|
||||||
@ -124,7 +123,7 @@ A caution symbol is added to the form submission icon because it has a higher ri
|
|||||||
**Restricted access:** ![User with lock icon](_images/user-lock.png)
|
**Restricted access:** ![User with lock icon](_images/user-lock.png)
|
||||||
|
|
||||||
Indicates that a file/folder has restricted access and will only be visible to certain users or groups. To learn more about the usage of this particular icon refer to
|
Indicates that a file/folder has restricted access and will only be visible to certain users or groups. To learn more about the usage of this particular icon refer to
|
||||||
[File Permissions](https://userhelp.silverstripe.org/en/4/creating_pages_and_content/creating_and_editing_content/images_and_documents/file_permissions).
|
[File Permissions](https://userhelp.silverstripe.org/en/creating_pages_and_content/creating_and_editing_content/images_and_documents/file_permissions).
|
||||||
|
|
||||||
## Overview of files with custom permissions
|
## Overview of files with custom permissions
|
||||||
|
|
||||||
@ -132,7 +131,8 @@ Indicates that a file/folder has restricted access and will only be visible to c
|
|||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> Folder with restricted access containing files with custom permissions and their associated file icons.
|
> Folder with restricted access containing files with custom permissions and their associated file icons.
|
||||||
> * FS - Form submission
|
>
|
||||||
|
> - FS - Form submission
|
||||||
|
|
||||||
To get started, create a new **User Defined Form** page in the CMS. See [Creating and editing forms](creating-and-editing-forms)
|
To get started, create a new **User Defined Form** page in the CMS. See [Creating and editing forms](creating-and-editing-forms)
|
||||||
to learn more. To add a File Upload field to the form, click on the ***Form Fields*** tab in the page editing view.
|
to learn more. To add a File Upload field to the form, click on the ***Form Fields*** tab in the page editing view.
|
||||||
@ -148,7 +148,7 @@ You can either create a new folder or use an existing folder to store your file
|
|||||||
The folder you select will become the default folder for this form and any additional Upload Fields which are added.
|
The folder you select will become the default folder for this form and any additional Upload Fields which are added.
|
||||||
Each File Upload Field can use different folders for storing its files, this can be managed by editing the folder location on each individual field.
|
Each File Upload Field can use different folders for storing its files, this can be managed by editing the folder location on each individual field.
|
||||||
|
|
||||||
#### Option 1, create a new folder (recommended):
|
#### Option 1, create a new folder (recommended)
|
||||||
|
|
||||||
This option is only available the first time you add an upload field to your form. Once the first upload folder for the form has been established,
|
This option is only available the first time you add an upload field to your form. Once the first upload folder for the form has been established,
|
||||||
all subsequent file uploads from the same form will use this folder by default.
|
all subsequent file uploads from the same form will use this folder by default.
|
||||||
@ -160,7 +160,7 @@ It will be recommended for this folder (and the submission files) to be placed w
|
|||||||
You can either use the suggested folder name or create your own by altering the folder name. You can also manually add deeper folder levels
|
You can either use the suggested folder name or create your own by altering the folder name. You can also manually add deeper folder levels
|
||||||
by adding ‘/’ in the text field provided e.g ‘Competition-entries/May-2020’.
|
by adding ‘/’ in the text field provided e.g ‘Competition-entries/May-2020’.
|
||||||
|
|
||||||
By default the ‘/Form-submissions’ folder is set so only [Admins](https://userhelp.silverstripe.org/en/4/managing_your_website/managing_roles_and_permissions/#using-roles)
|
By default the ‘/Form-submissions’ folder is set so only [Admins](https://userhelp.silverstripe.org/en/managing_your_website/managing_roles_and_permissions/#using-roles)
|
||||||
have permissions to access it (restricted access), any files or folders in this folder will inherit these permissions.
|
have permissions to access it (restricted access), any files or folders in this folder will inherit these permissions.
|
||||||
This can be changed manually on a per file/folder basis from the **Files** area.
|
This can be changed manually on a per file/folder basis from the **Files** area.
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ Click **Save and continue** to continue editing your form.
|
|||||||
|
|
||||||
![Create a new folder option](_images/modal-create-new-folder.png)
|
![Create a new folder option](_images/modal-create-new-folder.png)
|
||||||
|
|
||||||
#### Option 2, use an existing folder:
|
#### Option 2, use an existing folder
|
||||||
|
|
||||||
If you choose to use a folder that already exists you can select the folder from the **Select folder** dropdown. Once you select a folder,
|
If you choose to use a folder that already exists you can select the folder from the **Select folder** dropdown. Once you select a folder,
|
||||||
an icon will indicate whether or not the folder has restricted access and provide information for who the file uploads will be visible to.
|
an icon will indicate whether or not the folder has restricted access and provide information for who the file uploads will be visible to.
|
||||||
@ -192,13 +192,13 @@ When viewing/selecting folder locations from the form you will see an icon indic
|
|||||||
You will either see a **restricted access** icon, or a **warning** icon.
|
You will either see a **restricted access** icon, or a **warning** icon.
|
||||||
|
|
||||||
To store your files in a safer manor you can do one of several things:
|
To store your files in a safer manor you can do one of several things:
|
||||||
* Create a new folder from the Files area, or if this is your first time setting up an Upload Field for this form you will
|
|
||||||
be guided through the process, for more information see [Setting up a folder to store file uploads for your form](#Setting-up-a-folder-to-store-file-uploads-for-your-form).
|
- Create a new folder from the Files area, or if this is your first time setting up an Upload Field for this form you will be guided through the process, for more information see [Setting up a folder to store file uploads for your form](#setting-up-a-folder-to-store-file-uploads-for-your-form).
|
||||||
* Change the upload folder to one which already has restricted access. Edit the Upload Field and select a folder from the **Select a folder** dropdown.
|
- Change the upload folder to one which already has restricted access. Edit the Upload Field and select a folder from the **Select a folder** dropdown.
|
||||||
* Change the view access permissions of the current folder in the Files area to restrict access to the file.
|
- Change the view access permissions of the current folder in the Files area to restrict access to the file.
|
||||||
|
|
||||||
You can manage your folder permissions by navigating to the Files section in the CMS menu and edit the folders details.
|
You can manage your folder permissions by navigating to the Files section in the CMS menu and edit the folders details.
|
||||||
See [File Permissions](https://userhelp.silverstripe.org/en/4/creating_pages_and_content/creating_and_editing_content/images_and_documents/file_permissions)
|
See [File Permissions](https://userhelp.silverstripe.org/en/creating_pages_and_content/creating_and_editing_content/images_and_documents/file_permissions)
|
||||||
for more information and [Roles and permissions](https://userhelp.silverstripe.org/en/4/managing_your_website/managing_roles_and_permissions/) to learn more.
|
for more information and [Roles and permissions](https://userhelp.silverstripe.org/en/managing_your_website/managing_roles_and_permissions/) to learn more.
|
||||||
|
|
||||||
For more information on the usage of these icons in the files area, please refer to [File Indicators](https://userhelp.silverstripe.org/en/4/creating_pages_and_content/creating_and_editing_content/images_and_documents/file_permissions/#file-indicators).
|
For more information on the usage of these icons in the files area, please refer to [File Indicators](https://userhelp.silverstripe.org/en/creating_pages_and_content/creating_and_editing_content/images_and_documents/file_permissions/#file-indicators).
|
@ -7,30 +7,31 @@ summary: How to use the UserForms module to create forms via the CMS.
|
|||||||
|
|
||||||
## Before we begin
|
## Before we begin
|
||||||
|
|
||||||
Make sure that your SilverStripe CMS installation has the [UserForms](https://addons.silverstripe.org/add-ons/silverstripe/userforms/) module installed.
|
Make sure that your Silverstripe CMS installation has the [UserForms](https://addons.silverstripe.org/add-ons/silverstripe/userforms/) module installed.
|
||||||
|
|
||||||
## Data Protection and Privacy
|
## Data protection and privacy
|
||||||
|
|
||||||
**IMPORTANT: READ THIS BEFORE USING THE MODULE**
|
> [!Important]
|
||||||
|
> This feature allows authors with CMS permissions to create forms which process submission data,
|
||||||
|
> and store data the CMS database by default. Anyone with the ability to create forms
|
||||||
|
> also has access to view and export submissions. As the owner and operator of your website,
|
||||||
|
> you should ensure processes and safeguards are in place to perform these actions securely.
|
||||||
|
>
|
||||||
|
> This is your responsibility
|
||||||
|
|
||||||
This feature allows authors with CMS permissions to create forms which process submission data,
|
Here are a few tips to get you started:
|
||||||
and store data the CMS database by default. Anyone with the ability to create forms
|
|
||||||
also has access to view and export submissions. As the owner and operator of your website,
|
|
||||||
you should ensure processes and safeguards are in place to perform these actions securely.
|
|
||||||
|
|
||||||
This is your responsibility, but here are a few tips to get you started:
|
- Ensure you have the necessary consents for processing and storing data according to your legislation (e.g. GDPR)
|
||||||
|
- Only accept form submissions via encrypted transfers (HTTPS) - check our [Secure Coding](https://docs.silverstripe.org/en/developer_guides/security/secure_coding/) guidelines
|
||||||
* Ensure you have the necessary consents for processing and storing data according to your legislation (e.g. GDPR)
|
- Control access to form submissions (via CMS page access controls)
|
||||||
* Only accept form submissions via encrypted transfers (HTTPS) - check our [Secure Coding](https://docs.silverstripe.org/en/4/developer_guides/security/secure_coding/) guidelines
|
- Control access to files uploaded with submissions (via [folder access controls](field-types.md#file-upload-field))
|
||||||
* Control access to form submissions (via CMS page access controls)
|
- Create a process to limit the types of data you are allowed to collect via this feature (e.g. no payment information or health data)
|
||||||
* Control access to files uploaded with submissions (via [folder access controls](field-types.md#file-upload-field))
|
- Create a process for limiting submission storage duration (manual deletion)
|
||||||
* Create a process to limit the types of data you are allowed to collect via this feature (e.g. no payment information or health data)
|
- Consider further safeguards such as at-rest encryption (check [encryption related addons](https://addons.silverstripe.org/add-ons?search=encrypt))
|
||||||
* Create a process for limiting submission storage duration (manual deletion)
|
|
||||||
* Consider further safeguards such as at-rest encryption (check [encryption related addons](https://addons.silverstripe.org/add-ons?search=encrypt))
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* [Create and edit forms](creating-and-editing-forms.md)
|
- [Create and edit forms](creating-and-editing-forms.md)
|
||||||
* [Add different field types to a form](field-types.md)
|
- [Add different field types to a form](field-types.md)
|
||||||
* [Set up multipage forms](multipage-forms.md)
|
- [Set up multipage forms](multipage-forms.md)
|
||||||
* [View submissions and set up automated emails upon form completion](form-submissions.md)
|
- [View submissions and set up automated emails upon form completion](form-submissions.md)
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: Creating a multi-page form
|
|
||||||
---
|
|
||||||
|
|
||||||
## Creating a multi-page form
|
|
||||||
|
|
||||||
To create a multi-page form, simply click the 'Add Page Break' button.
|
|
||||||
This will create a page break field which is used to create a new page in the form. You can drag and drop this page break to separate form fields at the desired location.
|
|
||||||
|
|
||||||
![Multi-page forms](_images/multi-page-forms.png)
|
|
Loading…
Reference in New Issue
Block a user