1

Searched diligently before posting this but couldn't find an answer.

I'm working on a webform/view combo to edit contact's addresses.

I'm having trouble figuring out how to pass the location id in the url to the webform.

If I use node/(webform node number)?cid2=[id] it opens the webform with the primary address which works fine if contacts only have one address in the system.

Is it possible to pass the location id in the url for the webform?

3

The short answer is "no". Location types are handled in a very simple/dumb way by webform integration. When it looks up a contact it simply pulls all addresses (primary first, otherwise in no particular order) and populates address fields with them in order, and with no respect to location type settings for those fields (so the suggestion of pulling a default from $_GET wouldn't help you I'm afraid).

There is an open issue for improving this if you'd like to contribute.

  • @pmoz - I think this is the correct answer to your question albiet leaving you unsatisfied. please check as answered or ask another / modify ... – Sonicthoughts Jun 18 '15 at 15:01
1

You have to set that in the "CiviCRM" tab of the webform, when you add the field to the form (or choose "User select" for the "Address Location") here: Webform-CiviCRM address fields

You may be able to allow this to be set via the URL with some combination of "User Select" and the webform component's "Default value" (if you can add a $_GET variable as the default).

I believe that the first address field is always designated as primary in Webform CiviCRM at the moment (hard-coded/non-configurable).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.