The problem is: how to include values from a user's Profile2 fields as defaults for Webform 3 fields.

One solution, of course, is to upgrade to Webform 4. If you need to do this using Webform 3, however, you couldn't do it without "writing code."

Here's a workaround I haven't yet seen that involves no code writing:

  1. Assume our target is a Webform called "regform," and it has on it the usual suspects, like Company, Contact, Address, Phone, etc.
  2. Create a Basic Page and call it "pre-regform." Save it; no need to add anything to it.
  3. Whatever link you might have had pointing to "regform," have it point instead to "pre-regform."
  4. Create a Rule that does the following: "When a user views 'pre-regform,' redirect to 'regform/?company=[companytoken]&contact=[contacttoken]&city=[citytoken]' etc."
  5. Here's an example (my Profile2 profile name is "main"):

    regform?company=[site:current-user:profile-main:field-company]&contact=[site:current-user:profile-main:field-full-name-]&address=[site:current-user:profile-main:field-address]&address2=[site:current-user:profile-main:field-address2-]&phone=[site:current-user:profile-main:field-phone]&city=[site:current-user:profile-main:field-city]&state=[site:current-user:profile-main:field-state-province]&zip=[site:current-user:profile-main:field-zip]&email=[site:current-user:mail]

  6. On the "regform" webform, use the %get[company] syntax to populate your Company (and other) field.

Comments

stevengraff’s picture

Title: (Sort of) Simple Workaround to set defaults to Profile2 values » (Sort of) Simple Workaround to set Webform 3 defaults to Profile2 values

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.