This module makes it possible to prefill webforms.
- Remember values entered in the current browsing sessions.
- Values are stored in the browser using localStore, sessionStore and/or cookies.
- Prefill values can be added by using URLs formed in a specific way.
Install all the dependencies then activate the module. This should be enough to get the basic prefill functionality.
The modules needs PHP≥5.4.
The module will prefill all webform form elements as soon as it is enabled.
You can use the classes .webform-prefill-exclude
and .webform-prefill-include
to blacklist or whitelist parts of your forms. By default the whole form is
whitelisted.
You can use a weform component’s wrapper classes to exclude or include components easily.
You can add prefill values to the store by adding a special URL fragment to your links. For example:
- You enter the page the page using the URL
https://example.com#p:name=Alice
. - Later in this session you navigate to a webform.
- The webform contains a textfield component with the form key
name
which is prefilled with the value “Alice”.
You can still use fragments for something else by separating the prefill
part (p:…
) using from the rest of the fragment using a semi-colon ;
. That
means if you enter the website using https://example.com?#anchor;p:name=Alice
the prefill value is removed from the URL after the JavaScript is done and you
see the page as if you had entered https://example.com?#anchor
instead.
The JavaScript in this module is compatible with IE 11. However the required polyfills are not bundled. If you want to support these browsers you’ll neet to load an appropriate polyfill.
(At least) the following features need polyfilling:
- Promises