DTRT Form archived
A WordPress plugin to author simple, accessible forms.
by Dan Smith · github.com/dotherightthing/wpdtrt-form · website
Install
The author publishes release zips, so WP-CLI can install straight from GitHub:
wp plugin install https://github.com/dotherightthing/wpdtrt-form/releases/download/0.3.8/release.zipReadme
DTRT Form
Simple, accessible forms.
Features
- Autocomplete
- Inline JavaScript validation (optional)
- Inline Noscript validation (optional)
- Block Noscript validation error links list (optional)
- No Confirm Form Resubmission prompt on resubmit
Issues & Roadmap
See issues.
Setup and Maintenance
Please read DTRT WordPress Plugin Boilerplate: Workflows.
WordPress Installation
Please read the WordPress readme.txt.
WordPress Usage
Backend forms
Limited restyling of the WP Admin plugin options page.
Comment form
Styling and jQuery validation of the standard comment form (#commentform).
Custom form shortcode
Please use the provided shortcode to embed a custom form:
<!-- within the editor -->
[wpdtrt_form option="value"]
// in a PHP template, as a template tag
<?php echo do_shortcode( '[wpdtrt_form option="value"]' ); ?>
Options
template="contact"- generate a form from the template and JSON dataerrors_list="1|0"- display a list of errors above the form; clicking an error jumps the user to the affected fielderrors_inline="1|0"- display each error directly after the affected field;
Custom form fields
Edit the data file to change the field attributes or order: ./data/form-{templatename}.json
Styling
Core CSS properties may be overwritten by changing the variable values in your theme stylesheet.
See scss/variables/_css.scss.
Dependencies
JavaScript
Inline validation works with or without JavaScript, but is faster when JavaScript is enabled.
Demo pages
See plugin settings page in WP Admin.
Testing
Autocomplete
Chrome
- Preferences > Auto-fill > Addresses and more > Save and fill addresses
Emailing of form submission in local development
-
Install and run MailCatcher (see https://wordpress.stackexchange.com/a/195830):
gem install mailcatcher mailcatcher -
Update php.ini:
# php.ini (MAMP Pro: File > Edit > PHP > Version) sendmail_path = /Users/dan/.rvm/gems/ruby-2.6.3/wrappers/catchmail -f wpdev@localhost.dev # any email works smtp_port = 1025 -
MAMP Pro View > Postfix
- Include Postfix service in GroupStart
- Set domain of outgoing e-mails to:
localhostname.tld - Use a Smart host for routing: Server name:
127.0.0.1:1080
-
Send mail
-
Watch for mail at http://127.0.0.1:1080/
MailCatcher troubleshooting
-
Update php.ini (https://tommcfarlin.com/mailcatcher-mamp-wordpress/):
# php.ini smtp_port = 1025 sendmail_path = /usr/bin/env catchmail -f wpdev@localhost.dev -
Send mail:
# Apache log env: catchmail: No such file or directory -
Locate the path where gems are installed:
gem environment --help gem environment gemdir # /Users/dan/.rvm/gems/ruby-2.6.3 -
Locate the
catchmailbinary (executable):cd /Users/dan/.rvm/gems/ruby-2.6.3 && ls # bin build_info cache doc environment extensions gems specifications wrappers -
Update php.ini:
# php.ini sendmail_path = /Users/dan/.rvm/gems/ruby-2.6.3/bin/catchmail -f wpdev@localhost.dev` -
Send mail:
# Apache log send mail > env: ruby_executable_hooks: No such file or directory -
Refresh the
executable-hooksto the latest version (https://stackoverflow.com/a/29519638):sudo gem install --user-install executable-hooks -
Send mail:
# Apache log send mail > env: ruby_executable_hooks: No such file or directory -
Locate
ruby_executable_hooks:which ruby_executable_hooks # /Users/dan/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks # unsure how to use this information.. -
Update php.ini:
# php.ini sendmail_path = /Users/dan/.rvm/gems/ruby-2.6.3/environment catchmail -f wpdev@localhost.dev -
Send mail:
# Apache log Users/dan/.rvm/gems/ruby-2.6.3/environment: Permission denied -
Update php.ini (https://github.com/rvm/executable-hooks/issues/6#issuecomment-609032741):
# php.ini sendmail_path = /Users/dan/.rvm/gems/ruby-2.6.3/wrappers/catchmail -f wpdev@localhost.dev -
Send mail :)
Read the full README on GitHub →
Releases
| Tag | Published | Asset | Downloads |
|---|---|---|---|
| 0.3.8 | Aug 6, 2021 | release.zip | 6 |
| 0.3.7 | Jun 20, 2021 | release.zip | 6 |
| 0.3.6 | May 6, 2021 | release.zip | 7 |
| 0.3.5 | Apr 8, 2021 | release.zip | 9 |
| 0.3.4 | Mar 21, 2021 | release.zip | 7 |
| 0.3.3 | Feb 3, 2021 | release.zip | 2 |
| 0.3.2 | Feb 3, 2021 | release.zip | 2 |
| 0.3.1 | Feb 3, 2021 | release.zip | 1 |
| 0.3.0 | Feb 2, 2021 | release.zip | 3 |
| 0.2.4 | May 10, 2018 | release.zip | 6 |
| 0.2.3 | May 7, 2018 | release.zip | 4 |
| 0.2.2 | May 6, 2018 | release.zip | 3 |
| 0.2.1 | May 4, 2018 | release.zip | 6 |
| 0.2.0 | May 3, 2018 | release.zip | 6 |
Active-site estimate ≈10 comes from the median of recent superseded releases. Method.