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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Auto-complete for organization_name in a Profile form
Pages: [1]

Author Topic: Auto-complete for organization_name in a Profile form  (Read 3833 times)

scurra71

  • I’m new here
  • *
  • Posts: 18
  • Karma: 1
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.19
  • MySQL version: 5.0.51a
  • PHP version: 5.2.4-2ubuntu5.14
Auto-complete for organization_name in a Profile form
December 16, 2009, 02:01:04 am
Hi

I want to have individuals sign up for a mailing list using a Profile form. Included in that form is an "Employee of" field which effectively links the individual to an organization. It is possible that more than one employee from an organization might want to sign up for the mailing list so I want to have the "Employee of" field be an auto-complete field (to limit the variations on the entered organization names). What is the best method to accomplish this? The mailing list form contains firstname, lastname, email address, and "employee of": is a profile form the best method for this type of sign-up?

(This topic has shown up in the forums before so I am just checking whether or not new releases have superseded older solutions.)

Thanks,
Ryan

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Auto-complete for organization_name in a Profile form
December 16, 2009, 02:00:53 pm
First a question. Are you ok exposing all the Organizations in your DB to users filling in this form?

Assuming yes, since an auto-complete implies that .... there still isn't a 'no assembly required' solution for this. Some things to look at:

- Use the fairly new 'Contact Reference' custom field type in the profile. But you'll need to figure out a way to filter the contacts returned to only orgs, or (better solution IMO) only contacts in a specific group/ (If you're up for implementing a patch that would allow admin to specify a 'Limit listings to group' property on this type of custom field - that would definitely be useful to the community).

- Then use postProcess hook to create the Employee / Employer relationship
Protect your investment in CiviCRM by  becoming a Member!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Auto-complete for organization_name in a Profile form
December 16, 2009, 02:04:05 pm
Hi,

I'll try to post the details soon but we have implemented this - limiting the options to a smart group.

I will try to make time tonight to post up more
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

scurra71

  • I’m new here
  • *
  • Posts: 18
  • Karma: 1
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.19
  • MySQL version: 5.0.51a
  • PHP version: 5.2.4-2ubuntu5.14
Re: Auto-complete for organization_name in a Profile form
December 17, 2009, 12:18:14 am
Dave, Eileen

Thanks very much for the response. Yup, exposing org names is okay. I'll run the suggestions by my colleague (who is an experienced PHP developer) and await Eileen's follow-up post.

Regards,
Ryan

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Auto-complete for organization_name in a Profile form
December 17, 2009, 04:34:11 am
HI,

I hope to find time to explain this (maybe a blog) but in the meantime I'll just get the code I'm using up:

Some of the background is here:

http://civicrm.org/node/528

You need to backport this patch. http://issues.civicrm.org/jira/browse/CRM-4637 - as at 3.0.2 the listings.php patch wasn't required.

I will post more soon - when I get a chance.

Basically in the example given it does a REST call to the new API using this URL:

{crmURL p='civicrm/ajax/rest/profile' q='fnName=civicrm/profile/search&json=1&gid=5&sort=sort_name' h=0}"{literal};

gid is the number of  a civiCRM profile with and the profile is limited to a specific group. I'll try to get time to flesh this out
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

scurra71

  • I’m new here
  • *
  • Posts: 18
  • Karma: 1
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.19
  • MySQL version: 5.0.51a
  • PHP version: 5.2.4-2ubuntu5.14
Re: Auto-complete for organization_name in a Profile form
December 18, 2009, 01:11:43 am
Thanks very much Eileen. I'll give this a try -- or get my php-enabled colleague to.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Auto-complete for organization_name in a Profile form
December 18, 2009, 01:22:42 am
Good luck - it will make a lot more sense when I can write to explain but the lead up to Xmas is pretty mad!
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Auto-complete for organization_name in a Profile form
January 06, 2010, 02:23:53 am
I've written it - but you might be sorry you asked :-)

http://civicrm.org/node/685

Try working backwards from the summary at the end & post any questions here or on the blog.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

scurra71

  • I’m new here
  • *
  • Posts: 18
  • Karma: 1
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6.19
  • MySQL version: 5.0.51a
  • PHP version: 5.2.4-2ubuntu5.14
Re: Auto-complete for organization_name in a Profile form
February 16, 2010, 12:52:37 am
Thanks very much Eileen, and sorry about the late reply. The project fell off the radar for a bit but now it's back in focus.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Auto-complete for organization_name in a Profile form

This forum was archived on 2017-11-26.