CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Civi profile pre-populating from URL parameters
Pages: [1]

Author Topic: Civi profile pre-populating from URL parameters  (Read 1185 times)

Katy J

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 4
    • Third Sector Design
Civi profile pre-populating from URL parameters
November 03, 2010, 03:15:35 am
I'm trying to work out if there's a way to pre-populate a field in a profile based on the URL parameters from a form on another page.

This is what I want to achieve:

To have a 'micro eNews sign up' form on the home page of a site, where the user can enter their email address and click 'sign up'. They will then be redirected to a profile that has various fields. The email address field will already be populated with the address that the user entered on the previous page, and they can fill out the rest of the profile form themselves.

Does that make sense? Any suggestions would be most appreciated.

Cheers, Katy
Do what you love, it's your gift to the universe

Dwiding

  • I post frequently
  • ***
  • Posts: 165
  • Karma: 8
  • CiviCRM version: 3.3.3
  • CMS version: Joomla 1.5.x
Re: Civi profile pre-populating from URL parameters
November 07, 2010, 06:02:01 pm
Hi,

I'm trying to interpet why you would have them enter their e-mail address on one page, then click on a link to a signup page? Is there something else you are doing with the e-mail address submitted on that first page when they click on the Link that goes to the next page, which is the signup page?

Seems to me that you would just have them click on the link to signup, then enter their e-mail address and any other information you need to capture.

Best,

D

alanms

  • I post occasionally
  • **
  • Posts: 72
  • Karma: 5
Re: Civi profile pre-populating from URL parameters
November 07, 2010, 06:28:27 pm
I might have misunderstood, but I think the idea is, to have a really simple, tempting form on a main public-facing web page with one field, then when a person has 'committed' their email address, they're more likely to take up the offer of giving more information. It's good for drawing people in - it avoids scaring people away with a complicated-looking form too soon, and people keen to interact notice things they can interactive with like input fields more readily than they notice links.

Other similar cases where this kind of one-field pre-populating is a great idea include things like "Donate now!" widgets on web pages where you input an amount and are then taken to a page with a full payment and market data form.

Sorry I don't have any answers Katy - last time I looked into pre-populating fields for a very different purpose a while ago, I found the area impenetrable and went with an entirely different approach involving lots of hard-coding and API calls that wouldn't work here. I'm keen to hear people's suggestions on this one too - I'm sure there must be a simple method I missed.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Civi profile pre-populating from URL parameters
November 07, 2010, 07:08:27 pm

no easy UI based solution for now :(

The easiest way currently is to do so via hook_civicrm_buildForm and set the defaults as needed. This however requires code :(

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Katy J

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 4
    • Third Sector Design
Re: Civi profile pre-populating from URL parameters
November 08, 2010, 02:36:13 am
Yes, alanms is quite right - the idea being to draw sign-ups in with a simple form on the homepage, to then be redirected to a form that since it already has your email address in, you think - I may as well fill the rest in.

no easy UI based solution for now - The easiest way currently is to do so via hook_civicrm_buildForm and set the defaults as needed. This however requires code. Thanks for the clarification Lobo, that's fine. I'm going with the humble link for now until my developer skills get a bit more developed  :)

Cheers, Katy
Do what you love, it's your gift to the universe

Dwiding

  • I post frequently
  • ***
  • Posts: 165
  • Karma: 8
  • CiviCRM version: 3.3.3
  • CMS version: Joomla 1.5.x
Re: Civi profile pre-populating from URL parameters
November 08, 2010, 05:22:01 am
My programer might be able to assist, I'll pass it by him and see what it would take.  Now that you put it that way, I see the need.

D

alanms

  • I post occasionally
  • **
  • Posts: 72
  • Karma: 5
Re: Civi profile pre-populating from URL parameters
November 08, 2010, 05:38:42 am
I wonder if we couldn't put together a 7 line chunk of copy&pasteable code to meet needs like this? Something that includes:

  • A form input field
  • A line of Jquery to capture the input and send it to an appropriate AJAX API (e.g. 'Create membership' or 'Create contribution')
  • A line or two of Jquery that, if this worked, takes the ID of the newly created item and redirects to an 'Edit' profile page for that item (or displays an error if for any reason the AJAX api fails).
  • Enough comments that smart implementers without coding knowledge can easily figure out how to customise it. (link to the APIs page with handy examples, example of an extra field if they need more than one, and examples of other types of data that can be captured)

Certainly in the UK, this kind of functionality is a big deal at the moment. There's market research data showing it makes a notable improvement in uptake, the big charities are specifically requesting this feature, the big agencies are selling it hard, and it's becoming part of the standard set of features that industry consultants look for when appraising the quality of a charity website. As the leading open source product in the non-profit sector ( :) ) it'd be a great thing for us to facilitate!

I've not worked much with profiles yet so I wouldn't know about the forwarding part, but assuming profiles do edit by ID in this way, it should be pretty easy and assuming the APIs are uniform enough, it should be robust. Also, this approach would have the added advantage that if someone enters an email address then never gets around to filling in the other fields, we still have their email address. It wouldn't work with contributions without some cunning (some use of pledges or activities, maybe?) but it should work fine with everything else from mailing list signups to campaign actions or information requests.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Civi profile pre-populating from URL parameters

This forum was archived on 2017-11-26.