terminal42/contao-mp_forms
Composer 安装命令:
composer require terminal42/contao-mp_forms
包简介
An extension for Contao Open Source CMS to create multi steps forms using the form generator
关键字:
README 文档
README
This is a Contao extension that allows you to create real forms over multiple pages.
After installing the module, you have a new setting in the form definitions where you can define the GET parameter
you want the extension to work with. By default, this is step so it will generate step=1, step=2 etc. in the URL.
If, for whatever reason step is already in use on your webpage, you can change the settings there.
Moreover, you'll get a new form field called Page break. Every time you use this form field, the module will insert a
page break in the form.
mp_forms validates if a user manually wants to go to step 3 and did not fill in step 1 or 2. I this case the user will be redirected
to step 1 (obviously, only if you had required fields on step 1).
In case you don't want your users to be redirected but prefer to have some Ajax magic, you may combine this extension with our ajaxform one. They work perfectly well together!
⚠️ You may not use the regular submit form field element:
Note that you must not be using a regular submit form field but use the
Page breakagain. Otherwise, you won't have anybackbutton displayed.mp_formswill automatically detect the lastPage breakas behaving like the form submit. If you use the regular submit form field anywhere in your form,mp_formsis completely disabled and you won't have any steps!
The Summary element
A typical use case of forms that are split into multiple steps is to summarize data that was previously entered.
This might be on the final step before the data is submitted but it can also happen in between.
You can use this special form field type to display the data.
Accessing the data can be done via the "Simple Token" technology that is typical for Contao.
All the form fields of previous steps are passed on using the ##form_*## notation.
You may also access the labels using ##formlabel_*##.
Files are handled a bit differently because there is more than just one value to a file.
You may use extension, size, mime as well as a download_url which is generated for you.
To make things simple, the default token for the file (e.g. if the form field was named upload that would be ##file_upload##)
contains the HTML rendered using the ce_download template.
A simple summary for all the submitted fields, encapsulated in simple <div> elements can be displayed using
the ##mp_forms_summary## token.
Because trying things out yourself is usually easier and so you don't have to remember all the tokens that can be
used, you may simply place the ##mp_forms_debug## token which will show you all the available tokens with their
content.
Frontend module to display a step navigation
This module ships with a front end module that allows you to easily build a front end navigation for each of your steps. Not styled at all, it might look something like this in the end:
Note that by default steps will just be named Step x in every language. The Page break form field
label field will be used for the navigation if you provide it.
Insert tags
There are insert tags you can use to fetch information about the state of the form:
| Insert tag | Description | Example |
|---|---|---|
{{mp_forms::<form id>::step::current}} |
Contains the current step you are on | 2 |
{{mp_forms::<form id>::step::total}} |
Contains the total steps of your form | 5 |
{{mp_forms::<form id>::step::percentage}} |
Contains the percentage of your progress | 20 |
{{mp_forms::<form id>::step::numbers}} |
Contains a classic x of y display |
2 / 5 |
{{mp_forms::<form id>::step::label}} |
Contains the label of the current step | Step 1 |
{{mp_forms::<form id>::field_value::<field_name>}} |
Contains the submitted value of a previous field |
Note that they can be especially useful together with a Custom HTML front end module.
Let's assume you want to display a progress bar for form ID 5:
<div class="progress"> <div class="progress-bar"> <div class="progress-bar-inner" style="width:{{mp_forms::5::step::percentage}}%"></div> </div> <div class="numbers">{{mp_forms::5::step::numbers}}</div> </div> ```
terminal42/contao-mp_forms 适用场景与选型建议
terminal42/contao-mp_forms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 35.26k 次下载、GitHub Stars 达 25, 最近一次更新时间为 2015 年 01 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Forms」 「multi」 「step」 「contao」 「multipage」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 terminal42/contao-mp_forms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 terminal42/contao-mp_forms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 terminal42/contao-mp_forms 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
ConfirmationField is a form field for Atk14 applications. It's like the BooleanField (checkbox) but the ConfirmationField must be ticked.
Laravel Multiauth package
Theme and asset management for laravel
This package provides Laravel bindings and a Eloquent/Model trait for pragmarx/recovery package.
Field for number with restricted count of digits and decimal places
A PHP package to determine steps and progress.
统计信息
- 总下载量: 35.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 27
- 点击次数: 10
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2015-01-30
