3

I tried to follow the instructions here http://wiki.civicrm.org/confluence/display/CRMDOC/Webform+CiviCRM+Integration but I must be doing something wrong.

I created a webform that has household as contact 1 and individual as contact 2. In contact 2, I enabled relationship fields and selected is part of.

In the webform, if I select an existing household, it pulls up the info on the hh but does not populate the individual info.

If I create a new household and a new individual, it creates the household and the individual and a relationship but the relationship doesn't have a type, which isn't possible through the standard interface.

This is on civicrm 4.6.7

4 Answers 4

3

Prefilling a webform value depends on other values already being there. If the individual is not selected at the time the webform loads, then there's no way for it to populate the household. So you are correct, selecting a different contact 1 on the form will not cause contact 2 to be changed.

One workaround would be to create 2 webforms - the fist one being an incredibly simple form that allows you to autocomplete the individual's name and a submit button that redirects you to form 2 with cid in the url. Not perfect but it would work.

1
  • I think a multi-page form can also do this, right? (ie. the first contact is on page one, then when they go to page two it prefills by relationship from the first page)
    – Laryn
    Commented Apr 10, 2019 at 20:51
3

For admins we tend to provide them with a View, or even a View block 'search' so that they can quickly find the person who will be cid=1 and then provide a link on that to the webform so cid=1 is in the url and all related contacts on the form also prefill.

1

"In the webform, if I select an existing household, it pulls up the info on the hh but does not populate the individual info."

In the webform component for the 'individual existing contact' field you need to set the Filter so that it will prefill if it can find a contact by specifying the relationship.

Is that a step you might have missed?

3
  • Hmm, I didn't do that, somehow missed that. (It looks like it's not the filter but default value). Now it will save a new contact correctly but it still won't pull up an existing individual that is a household member of contact 1.
    – Paul-Tahoe
    Commented Sep 21, 2015 at 7:13
  • hmm - if this is a problem similar to the one i describe here it may help if you can explain in detail your set up there. drupal.org/node/2383011. Just to confirm, if you go to the url with cid1=<id of household> do the related people prefill?
    – petednz - fuzion
    Commented Sep 21, 2015 at 9:41
  • Interesting. It does work if you add the cid to the url, but not if you select the hh from webform. Of course, I'd like to select the household. I'm updated a number of people. In the morning I'll detail how it's set up.
    – Paul-Tahoe
    Commented Sep 21, 2015 at 9:49
1

Unless you have some very unusual circumstances, you should not make Contact 1 a household. Contact 1 is meant to represent the person filling out the form (e.g. the user) and houses are generally unable to operate a keyboard ;)

I suggest making contact 1 an individual and contact 2 the household.

6
  • Very true. I had tried that first and it didn't work any better. Then I thought I'd try with a completely new webform and the other direction in case that worked better. I just tried again with contact1 ind and contact2 hh and it still only pulls up the hh if I give the cid.
    – Paul-Tahoe
    Commented Sep 23, 2015 at 23:01
  • Oops I see I left out of the last sentence and got another wrong and it won't let me edit it. Should be: it still only pulls up the ind unless I give the cid
    – Paul-Tahoe
    Commented Sep 24, 2015 at 0:01
  • It's true, prefilling a value depends on other values already being there. If the individual is not selected at the time the webform loads, then there's no way for it to populate the household. So you are correct, selecting a different contact 1 on the form will not cause contact 2 to be changed.
    – Coleman
    Commented Sep 24, 2015 at 2:39
  • So if I read this correctly, webforms can really only be used for new data or if you send a link to the person for them to update their info directly. If an admin type wishes to view and possibly update an individual and its household, they can't use webforms (well unless they know the cid). I hope I'm missing something.
    – Paul-Tahoe
    Commented Sep 24, 2015 at 16:21
  • Correct. Pre-filled information only works with information that's known at the time the form renders. See 2nd answer for a potential workaround.
    – Coleman
    Commented Sep 24, 2015 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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