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 Profiles (Moderator: Dave Greenberg) »
  • Make current_employer an autocomplete -- it won't search, what am I missing?
Pages: [1]

Author Topic: Make current_employer an autocomplete -- it won't search, what am I missing?  (Read 1840 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Make current_employer an autocomplete -- it won't search, what am I missing?
July 01, 2011, 12:48:42 am
I recently upgraded a site from 3.2.3 to 3.3.6.

I'm using this code in Register.tpl custom file, locked within an {if} statement making it available to logged in users only.
Code: [Select]
<script type="text/javascript" src="{$config->resourceBase}js/rest.js"></script>
{literal}
<script>
jQuery(document).ready(function($){
  $('#current_employer').crmAutocomplete({params:{contact_type:'Organization'}});
});
</script>
{/literal}

The code shows up on the page.  The code converts current employer to an autocomplete (the little magnifying glass shows) but the autocomplete doesn't work.   I am a logged in user.

The autocomplete doesn't react to input, and offers no results.  I have tried checking the CiviCRM log and there are no errors.   Error console in firefox shows now errors.  I have tried switching themes to Garland, with no results.  I have disabled all custom php files, nothing.

Am I getting the code wrong, or has something changed in 3.3 that I am not aware of.  I've tried looking in the docs and haven't gotten any clues.


You can check it out here (feel free to create an account).

https://www.nonprofitoregon.org/civicrm/event/info?reset=1&id=144

« Last Edit: July 01, 2011, 12:52:33 am by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Make current_employer an autocomplete -- it won't search, what am I missing?
July 01, 2011, 01:40:46 am
Hi,

What's the url that is called on the autocomplete (on the net tab)

X+

P.S. Just looking at js/rest.js I'll need to work on it to make it more api3 friendly
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Make current_employer an autocomplete -- it won't search, what am I missing?
July 01, 2011, 06:44:01 am
If I had to guess it might be something related to permission.

Kurund
Found this reply helpful? Support CiviCRM

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Make current_employer an autocomplete -- it won't search, what am I missing?
July 01, 2011, 09:13:13 am
thanks both of you

@kurund, thanks I was hoping it was something simple like that, but i've tried with my admin user who has all permissions and the autocomplete for current employer still doesn't work.   It's worth noting that the autocomplete on the 'on behalf of' portion of a different contribution form DOES work.

@xavier not sure what you mean.  do you mean "/sites/all/modules/civicrm/js/rest.js" ?

@xavier: Besides putting the snipped of code above in the .tpl file, is there anything else necessary to get crmAutocomplete to work?    I've considered that maybe rest.js changed from 3.2 to 3.3, maybe I should switch out the file with the old version, or the new 3.4 version of rest.js?

UPDATE
This morning I found this error that might be releated in the .log file
Code: [Select]
Jul 01 07:41:56  [info] $Fatal Error Details = Array
(
    [message] => Could not find valid value for id
    [code] =>
)


Jul 01 07:41:56  [info] $backTrace = /home/nonprofitoregon/public_html/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 277
/home/nonprofitoregon/public_html/sites/all/modules/civicrm/CRM/Utils/Request.php, fatal, 109
/home/nonprofitoregon/public_html/sites/all/modules/civicrm/CRM/Event/StateMachine/Registration.php, retrieve, 58
/home/nonprofitoregon/public_html/sites/all/modules/civicrm/CRM/Event/Controller/Registration.php, __construct, 48
/home/nonprofitoregon/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(215) : eval()'d code, __construct, 1
/home/nonprofitoregon/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php, eval, 215
/home/nonprofitoregon/public_html/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 355
, civicrm_invoke,
/home/nonprofitoregon/public_html/includes/menu.inc, call_user_func_array, 349
/home/nonprofitoregon/public_html/index.php, menu_execute_active_handler, 17
« Last Edit: July 01, 2011, 09:37:23 am by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Make current_employer an autocomplete -- it won't search, what am I missing?
July 05, 2011, 06:26:25 pm
I backported js/rest.js from a 3.4.4 version to my 3.3.6 version and the current employer auto-complete worked

Never could figure out what was wrong with the 3.3.6 version, but I confirmed on another 3.3.6 install that the auto-complete wouldn't work there either.  It was not a theme or permissions issue, i guess rest.js just didn't work for autocomplete in 3.3.6?

Any negative side-effects of doing this backport?

Try CiviTeacher: the online video tutorial CiviCRM learning library.

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: Make current_employer an autocomplete -- it won't search, what am I missing?
July 06, 2011, 12:13:08 am
Stoob - thanks so much for posting the code for the autocomplete this week - it is just what I needed and saved me some hunting - I owe you one  :)
The code in the original post worked perfectly for me in 4.0.4
« Last Edit: July 06, 2011, 12:18:43 am by petednz »
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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Make current_employer an autocomplete -- it won't search, what am I missing?
July 06, 2011, 12:16:54 am
Quote from: Stoob on July 05, 2011, 06:26:25 pm
Any negative side-effects of doing this backport?

OOps, didn't realise that you were on 3.3 and now I remember that I fixed it on 3.4

IMO No issue to backport. For future reader, that's likely that rest.js is going to use API v3 specific syntax soon (eg you won't be able to backport that easily versions after 3.4.5

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

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: Make current_employer an autocomplete -- it won't search, what am I missing?
July 06, 2011, 03:35:17 pm
minor update and help request  ???

i am using this on an event that allows Multiple Participants.

So I tried adding the above code to the bottom of AdditionalParticipant.tpl but no joy yet - i see that tpl calls TrackingFields.tpl

Any advice on where i should be adding this?

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

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: Make current_employer an autocomplete -- it won't search, what am I missing?
July 10, 2011, 04:39:41 pm
sorted - i thought i needed to have it inside the {/if} that was after the {/literal}but am wondering if the {/if} might be the problem - anyhow, works now i have it outdside the if clause.
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

reperry

  • I post occasionally
  • **
  • Posts: 59
  • Karma: 2
Re: Make current_employer an autocomplete -- it won't search, what am I missing?
September 23, 2011, 05:05:32 pm
Peter, noticed this as I was looking on the forum for info about event registration when registering multiple participants:
Quote from: petednz on July 06, 2011, 03:35:17 pm
minor update and help request  ???

i am using this on an event that allows Multiple Participants.



Two questions:

1) I've been allowing folks to register multiple participants, and it seems funky. Have you had success with it? For paid events, it doesn't seem possible to allow the one person registering to pay for all registrants. I also can't delete any duplicate registrations (which commonly happen) because I can't tell if that will delete all the participants they registered.

2) What are you using the ajax auto-complete for in the multiple participant registration? (Just curious)

Thanks! I'll repost in separate thread if it'd be more helpful.

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: Make current_employer an autocomplete -- it won't search, what am I missing?
September 23, 2011, 05:33:52 pm
Quote
1) I've been allowing folks to register multiple participants, and it seems funky. Have you had success with it? For paid events, it doesn't seem possible to allow the one person registering to pay for all registrants. I also can't delete any duplicate registrations (which commonly happen) because I can't tell if that will delete all the participants they registered.

2) What are you using the ajax auto-complete for in the multiple participant registration? (Just curious)

Hi
#1 if you are asking about multiple participants in general then yes - separate thread - and if you are asking 'does it work' - yes - if it isn't doing so on your system then set one up on Demo and try it there.
#2 current employer as per this thread title
HTH
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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Make current_employer an autocomplete -- it won't search, what am I missing?

This forum was archived on 2017-11-26.