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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Select contacts in Webform from Civicrm database in Drupal
Pages: [1]

Author Topic: Select contacts in Webform from Civicrm database in Drupal  (Read 1048 times)

adalsi

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal 7.17
  • MySQL version: ...
  • PHP version: ...
Select contacts in Webform from Civicrm database in Drupal
January 30, 2013, 07:38:41 am
Hello guys,

We are french students and we are creating a website with 3 types of contacts (Students, Teachers and Companies), it's a kind of direcory of alumni.

We want to create a form (with the webform module) where the user (students) could link him self to another type of contacts (companies or teachers). To do this, we create a custom field of the type contact reference, with Autocomplete Select, when we preview the result in CiviCRM it works well (like that -> Attachment: Screenshot.jpg ).

But when we create a webform (we go in civicrm tab and enable Civicrm processing) and then we create our form. Unfortunately when the user (student) fill out the form he can't select a teacher or a companies from the civicrm database, he only can select a "webform contact", (in case Contact1) (like that -> Attachment: capture.jpg )

For more understanding. Clearly we would like to students can add a professionnal tutor and a company tutor for a internship.

Any suggestions would be of great help.

Many thanks,

Adeline
Alexis
Simon

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Select contacts in Webform from Civicrm database in Drupal
January 30, 2013, 12:31:52 pm
If you are using webform-civicrm then you don't need the custom field you described.
Set the form up to use 2 civicrm contacts.
Contact 1 is the Student
Contact 2 is the Tutor - set to 'Existing Contact'
On Contact 2 Enable Relationships Field - and set that up.
Then in the webform settings for Contact 2 set it up as autocomplete, remove Permissions, and set the Default Value so 'Set default contact to' is 'Relationship to Contact 1' and 'Specify relationship' to be 'tutor is' (or whatever)

from memory that should get what you want - hope i didn't skip any steps.

bon chance
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

adalsi

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal 7.17
  • MySQL version: ...
  • PHP version: ...
Re: Select contacts in Webform from Civicrm database in Drupal
January 31, 2013, 07:22:34 am
 Merci pour ton aide petednz ! (It means Thanks for your help ;) )

We try what you said but we came across a problem at this step "Contact 2 set it up as autocomplete, and set the Default Value so 'Set default contact to' is 'Relationship to Contact 1'"

We don't know where to set the Contact 2 as autocomplete and set the default value. These fields don't appear (We are in the Civicrm tab)

We hope our english is understandable and for more understanding we add some screen (it's our civicrm tab in webform Etudiant=student and enseignant=teacher).

Many thanks,

Adeline
Alexis
Simon

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Select contacts in Webform from Civicrm database in Drupal
January 31, 2013, 10:01:00 am
On the "Webform" tab, click to edit the contact 2 "Existing Contact" field - you will see options for display (use autocomplete) and autofill (set to "by relationship to contact 1)
Try asking your question on the new CiviCRM help site.

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Select contacts in Webform from Civicrm database in Drupal
January 31, 2013, 10:04:23 am
I just read your original post.
Setting this up in webforms is more complex than in core civicrm, but it is also more powerful and flexible. I think you will find it can do exactly what you want.
You can also set up a "filter" (when editing the existing contact field for contact 2) set to contact type = teacher
You should read these instructions, they help: http://drupal.org/node/1615380
Try asking your question on the new CiviCRM help site.

adalsi

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal 7.17
  • MySQL version: ...
  • PHP version: ...
Re: Select contacts in Webform from Civicrm database in Drupal
February 01, 2013, 08:25:53 am
Thanks Coleman Watts !

We followed your instructions, we read the documentation http://drupal.org/node/1615380 and we are about to succeed but the autocomplete doesn't function.

We download the jQuery plugin Tokeninput we extract as the folder "sites/all/libraries/tokeninput" but unfortunately we still have the error message "Could not find the jQuery TokenInput library. Please download it and extract as the folder "sites/all/libraries/tokeninput". This is required for the autocomplete to function."

So we would like to know if there is settings to changed as it's explained in the attachment or here -> http://loopj.com/jquery-tokeninput/ or if you are any tips it would be great.

Adeline
Alexis
Simon

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Select contacts in Webform from Civicrm database in Drupal
February 01, 2013, 09:29:47 am
Check that the path to the js file is exactly this:
sites/all/libraries/tokeninput/src/jquery.tokeninput.js
Try asking your question on the new CiviCRM help site.

adalsi

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal 7.17
  • MySQL version: ...
  • PHP version: ...
Re: Select contacts in Webform from Civicrm database in Drupal
February 06, 2013, 05:49:32 am
Merci Coleman Watts !

It's workinnnnnng !
finally.

Problem solved !

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Select contacts in Webform from Civicrm database in Drupal

This forum was archived on 2017-11-26.