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 autocomplete
Pages: [1]

Author Topic: webform autocomplete  (Read 2441 times)

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
webform autocomplete
May 02, 2012, 03:12:42 am
Hey there,

We have a webform (http://networks.futurefirst.org.uk/school-sign-up).

It has two contacts in it.  An organisation and an individual.  We want to select from existing organisational contacts, but allow them to create new individual contacts.

At the moment, they are able to create a new organisational contact as well (which will create a new contact in the database).

Is there any best practice / do you have any ideas for restricting the autocomplete of the org contact to contacts in the database.  I am thinking webform validation, but maybe there is a checkbox somewhere that i am missing.

Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: webform autocomplete
May 04, 2012, 10:45:10 pm
Hi Michael. What you've done so far is impressive! How did you do it? Is this with jquery-based api calls? Can I see your code?
I may be able to help you with the validation issue -- I worked on something similar (actually a module called webform_autocomplete which does perform this validation)
Try asking your question on the new CiviCRM help site.

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: webform autocomplete
May 08, 2012, 07:26:33 am
Hey Coleman :) How is it going over there?

You can see the codebase here: https://github.com/michaelmcandrew/ff

with all (I think) custom code here: https://github.com/michaelmcandrew/ff/tree/master/drupal/sites/all/modules/custom

The bit that does the autocomplete is in: https://github.com/michaelmcandrew/ff/blob/master/drupal/sites/all/modules/custom/webform_auto/webform_auto.module starting at lines 6-7.  We are using hook_civicrm_contactListQuery();

Just had a look at your webform_autocomplete.  Looks like there might be bits of that that are suitable.

We do have webform_validation installed and are doing phone validation via that (although actually not on that form).

Just had a look at http://docs.jquery.com/Plugins/Autocomplete/autocomplete#url%5For%5Fdataoptions and found out there is a mustMatch option. I'll investigate adding that. Should work in this case since it is a required field.  (Thinking about it, I guess CiviCRM must use this option internally) Lets see...
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

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: webform autocomplete
May 13, 2012, 03:01:42 am
hmm - watching this with interest - not clear to me if there are several routes to doing this or you at getting to a point of bringing them all in to one exquisite solution ;-)
http://drupal.org/node/1566008
http://drupal.org/node/1379662
http://drupal.org/project/webform_autocomplete
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

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: webform autocomplete
May 13, 2012, 09:36:51 am
Yes, this project is now underway and is going to be wicked cool. So far I've got sponsorship for autocomplete of existing contacts based on contact type & sub-type. This will work as an alternative to filling out the name, email, etc for a contact on the webform, and can also support either/or scenarios (search for existing, if none found, create new). Should have it working by the end of this week.
Some additional sponsorship I'd like to get is:
  • More ways to filter the results list (by group, relationship, permission, or tag).
  • Bringing the contact ref custom field under this roof.
  • More behavior options such as pre-emptive fill (similar to the way current employer works now, but would work with any relationship type or other params and offer more control).
Any of that appeal to you?
Try asking your question on the new CiviCRM help site.

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: webform autocomplete
May 13, 2012, 08:51:56 pm
yes i think this broadly covers needs of a couple of clients - do you have an estimate yet?
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

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: webform autocomplete
May 14, 2012, 09:24:54 am
Yes, let's talk :)
Try asking your question on the new CiviCRM help site.

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: webform autocomplete
May 14, 2012, 12:28:51 pm
Sure - also need civi fields that are Contact REference to be sorted in Webform as Display name , not as CID

And of course the one about when you add a new contact to a Group in civi, that name shows immediately in the dropdown/autocomplete in webform, rather than having to resave the webform component to get them to show on the form.
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

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: webform autocomplete
May 14, 2012, 01:27:23 pm
Yes to both. Basically I'm creating a new type of webform field for referencing a contact that actually pulls from the Civi database. This will be a big improvement over the simple webform select that just holds a static list of values.
I've emailed you with a quote.
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 autocomplete
June 01, 2012, 08:34:16 pm
Just wanted to mention that I've added some quite robust autocomplete/select/autofill capabilities into the 3.x branch of webform_civicrm. Enjoy!
Try asking your question on the new CiviCRM help site.

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: webform autocomplete
June 14, 2012, 10:27:51 am
hey coleman - yeah cool - i did see that and will check it out - looks like the dev. version is pretty active at the moment as well.  if you are on the look out for feature requests ;) then how about open a new case each time you submit a webform.  that would be really useful in conjunction with the limit on the amount of times a webform is submitted to allow people to, for example, make three applications to a funding round.

michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: webform autocomplete
June 14, 2012, 11:58:55 am
Webform CiviCRM can already open cases - have you played with that feature yet?
Try asking your question on the new CiviCRM help site.

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: webform autocomplete
June 18, 2012, 02:05:52 am
yeah but the user interface doesn't give you the option to always open a new case.

In our use case, we want to give a single logged in user the ability to make three different applications for funding.  At the moment it says 'If "Application" case with this status already exists for this contact, the activity will be added to that case. Otherwise a new case will be opened with this status.'

It would be cool to have another option to always open a new case and have webform control the maximum number of applications you can make.

Which would support our business logic that one person can make three different applications for funding as part of this round.

We'd be happy to pay for the development of that functionality if you are looking for sponsors.
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • webform autocomplete

This forum was archived on 2017-11-26.