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 Drupal Modules (Moderator: Donald Lobo) »
  • Webform custom field contact reference
Pages: [1]

Author Topic: Webform custom field contact reference  (Read 800 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Webform custom field contact reference
January 13, 2014, 06:39:58 am
Hi,

Got a field custom reference, filtered on the subtype. Works all good.

However, I chose both organization_name and country as the fields to display, but only the organization name is displayed. I checked, the organisations have an address with a country (only the country is filled), and this address is set as primary (but it's not the location type HOME).

anyway, I was expecting to have the name followed by the party in the autocomplete result. Is this working as intended and I should adjust my expectations or is there something that went wrong somewhere?

X+

P.S. I need to filter the list based on other criteria, namely the country the user choose in the list. I'm switching from autocomplete to select and writing a custom module that populates the select accordingly.
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Webform custom field contact reference
January 13, 2014, 10:24:54 am
Quote
I'm switching from autocomplete to select and writing a custom module that populates the select accordingly.
Thanks to Drupal FAPI security you might find this more difficult than you expect.
Easiest solution (assuming you don't have a million records) is to have the select show all records, and then use a little jQuery to hide the ones who are not in the selected country.
But for that to work (chicken and egg) you need the country to display properly. Hang on a sec that might be a bug...
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: Webform custom field contact reference
January 13, 2014, 10:50:53 am
Ok that was indeed a bug. Fixed it and also pushed out a release since we were overdue for that anyway.
https://drupal.org/node/2172739
Try asking your question on the new CiviCRM help site.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Webform custom field contact reference
January 14, 2014, 12:37:06 am
Quote from: Coleman Watts on January 13, 2014, 10:24:54 am
Quote
I'm switching from autocomplete to select and writing a custom module that populates the select accordingly.
Thanks to Drupal FAPI security you might find this more difficult than you expect.
Easiest solution (assuming you don't have a million records) is to have the select show all records, and then use a little jQuery to hide the ones who are not in the selected country.

What I did at the end: custom module that alters the form, use the api to fetch all the possible contacts on the select, with all the fields I needed to filter (org name+country) and build an array of contacts grouped by country.

and indeed rebuild the list of options based on that list everytime the user changes a country.

The good part is that I can put whatever I want on the option, as long as the value matches.

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Webform custom field contact reference
January 14, 2014, 12:38:52 am
Quote from: Coleman Watts on January 13, 2014, 10:50:53 am
pushed out a release

Thanks!
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Webform custom field contact reference
January 14, 2014, 09:07:44 am
Quote
rebuild the list of options based on that list everytime the user changes a country.
Are you doing that server-side or client-side?
Try asking your question on the new CiviCRM help site.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Webform custom field contact reference
January 14, 2014, 10:46:52 pm
client side
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Webform custom field contact reference

This forum was archived on 2017-11-26.