Skip to content

Mauticform prefill#1

Open
jordan8037310 wants to merge 15 commits intobadri:7.xfrom
FacetInteractive:mauticform-prefill
Open

Mauticform prefill#1
jordan8037310 wants to merge 15 commits intobadri:7.xfrom
FacetInteractive:mauticform-prefill

Conversation

@jordan8037310
Copy link
Copy Markdown

Mautic form pre-filling using hashparams in the URL.
Issue: #26

Test:

  1. Apply PR
  2. On a page where Mautic Form is embedded with Drupal shortcode method
  3. You can prefill an embedded Mautic form in Drupal page by passing form keys as Hash params in the URL. e.g. /your-form-url#p:email=email@somedomain.com&firstname=John&lastname=Doe

This is a fork of work originally done for webform_prefill. Rather than trying to generalize that module I used the same JS approach for Mautic.

Note: Requires jquery_update

jordan8037310 and others added 15 commits May 28, 2017 13:54
Thanks to @moreonion for work on webform_prefill

Now, you can prepopulate an embedded Mautic form in Drupal page by passing form keys as Hash params in the URL
e.g. /your-form-url#p:email=jordan@facetinteractive.com&city=manhattan beach

# Use Case
Our use case was we needed to prepopulate fields when progressive profiling for users when they submit an initial newsletter subscription form.

# Redirecting from Other Forms
If you’re passing inputs to the url via another Mautic form , you will need to HTML encode the param inputs in the URL Redirect Link, e.g.
/your-form-url#p:email={formfield=email|true}&city={formfield=city|true}, where |true is the boolean for turning on HTML encoding.

Included code from the fork may be excessive. I made the smallest number of changes possible in order to get this working.

@todo - Look at LocalStorage instead of Session Storage
@todo - Perhaps consider incorporating this in Mautic Core instead of Drupal module so that prefill functionality is consistent across all embeds.
Tracking Pixel, Shortcode Embed Forms, Shortcode Embed Dynamic Content
Fix Help Text per recent changes to 7.x
Appropriate fix to trim trailing slash on domain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants