The Prepopulate module allows fields in most forms to be pre-populated from the $_REQUEST variable.
Prepopulate is excellent for creating bookmarklets. For examples on usage for all of these cases, please read the USAGE file that comes with the module or you can read the online handbook page.
Drupal 8
The format in D8 has changed. It uses the field/form array structure. This typically means you should use [widget][0][value]
as part of the URL for field backed form inputs.
Pre-populate the title field on a node creation form:
- http://www.example.com/node/add/page?edit[title][widget][0][value]=simple title
Pre-populate the body field:
- http://www.example.com/node/add/page?edit[body][widget][0][value]=hello world
Pre-populate an entity reference field:
- http://www.example.com/node/add/page?edit[field_entity_reference][widget][0][target_id]=123
Note: For security reasons, Drupal 8 version of this module does not support radios/checkboxes. This means by default, someone cannot craft a specially formatted URL that automatically adds permissions (checkboxes) or changes admin config options (radios). Nor does it support overwriting any existing values in inputs. The later cannot be turned off. But if you really need radios/checkboxes, implement hook_prepopulate_whitelist_alter
to add additional allowed form elements. Use with caution.
Drupal 7
In previous version of Drupal, the following URL example will work:
http://www.example.com/node/add/blog?edit[title]=this is the title
It will automatically fill the Title field on a new blog post with the words "this is the title". Any field can be prepopulated this way, including taxonomy and CCK fields. You can prepopulate more than one field at a time as well.
Important Note
As of Prepopulate 7.x-2.1 the ability to base64 encode request parameters has been removed. See this security advisory for more information.
Project information
- Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed. - Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Content Editing Experience
- 8,134 sites report using this module
- Created by chx on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 8.x-2.x-dev updated 13 Feb 2023 at 15:12 UTC
Development version: 7.x-2.x-dev updated 3 Nov 2017 at 14:23 UTC