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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
Pages: [1]

Author Topic: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working  (Read 2339 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
After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
December 27, 2011, 10:40:55 pm
Hey, recent upgrade to 3.4.8 from 3.3.6 and having a trouble with the crmAutocomplete function.  Used to work with 3.3.6.   This setup is something Xavier helped me figured out and it's detailed in Floss manuals here:

http://en.flossmanuals.net/civicrm/ch066_api/
Code: [Select]
$('#current_employer').crmAutocomplete.....

What I'm expecting to happen is that the results of the autocomplete are clickable, but results are not clickable  (note that you must be logged in for the crmAutocomplete to show at all, but logins are free and available to create one)
Here's the live page:
https://www.nonprofitoregon.org/civicrm/event/register?id=125&reset=1


Quote
Error: value is undefined
Source File: https://www.nonprofitoregon.org/sites/all/modules/civicrm/packages/jquery/plugins/jquery.autocomplete.js?0
Line: 414

This is the line producing the error:
Code: [Select]
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");

This is the code actually included on the page.
Code: [Select]
        <script type="text/javascript" src="/sites/all/modules/civicrm/js/rest.js"></script>
<script>
jQuery(document).ready(function($){
  $('#current_employer').crmAutocomplete({params:{contact_type:'Organization'}});
});

</script>

Any ideas what changed recently with rest.js?  It's not a permissions issue, the user I am logged in as has all CiviCRM permissions.

Thanks!

« Last Edit: December 27, 2011, 11:00:22 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
December 27, 2011, 10:44:03 pm
It might be something that needs to use v2 api (or be updated to v3 in some way) - you may be able to add 'version' => 2 to the API call

In 3.4 it will probably default to using v3 api
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

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: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
December 27, 2011, 11:02:56 pm
That's a clue ... and a good theory - thanks.   Any idea what the syntax for that might look like?   I don't see any clues there in the documentation.   I guess I could email Xavier.
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
December 27, 2011, 11:08:21 pm
Try editing

  $('#current_employer').crmAutocomplete({params:{contact_type:'Organization'}});

To

  $('#current_employer').crmAutocomplete({params:{contact_type:'Organization'}{version:2}});
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

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: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
December 27, 2011, 11:40:58 pm
thanks but not quite....  i'll email xavier

Quote
Error: missing } after property list
Source File: https://www.nonprofitoregon.org/civicrm/event/register?id=125&reset=1
Line: 897, Column: 78
Source Code:
  $('#current_employer').crmAutocomplete({params:{contact_type:'Organization'}{version:2}});



Try CiviTeacher: the online video tutorial CiviCRM learning library.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
December 27, 2011, 11:43:33 pm
Hmm - I just guessed at the syntax - looks like it goes inside the curlies

http://www.json.org/js.html
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

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: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
December 27, 2011, 11:51:32 pm
Thanks for the link, unfortunately I still don't understand the syntax.  I hope you enjoyed that JSON documentation page as much as I did, "it can be used in the language with no muss or fuss" it was just the sort of a surreal bit of humor that I need at nearly midnight local time for me.    I tried several different variations of where to put 'version:2' with no good results.

Seeing that we're operating under the assumption that using API v2 would solve the problem anyway, I don't need to ask you for any more of your time.  I'll email Xavier.  Thanks.
« Last Edit: December 28, 2011, 12:01:47 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: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
December 28, 2011, 04:36:30 am

Quote
$('#current_employer').crmAutocomplete(
{params:
  {contact_type:'Organization'
  ,version:2
  }
});
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

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: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
December 28, 2011, 09:02:08 am
Thanks for the code.  Unfortunately this doesn't change the behavior of the autocomplete, it still doesn't work.

Here is the video:
http://www.youtube.com/watch?v=aAXEfqtSJhw&feature=youtu.be

Code: [Select]
        <script type="text/javascript" src="/sites/all/modules/civicrm/js/rest.js"></script>
<script>
jQuery(document).ready(function($){
  $('#current_employer').crmAutocomplete(
    {params:
      {contact_type:'Organization'
      ,version:2
    }
  });
});

</script>

I understand this is the holiday season and it is difficult to work.  if you have more ideas, please post.  I'm going to record a video of it in action.  Maybe I have misconfigured it or don't understand, but the code has changed little and all of the sudden after upgrade doesn't work.   I'll turn off Autocomplete until we can discuss again and find a solution.

Thanks very much!
« Last Edit: December 28, 2011, 01:29:52 pm 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: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
February 13, 2012, 11:56:52 pm
Ah, anyway time to switch to version 3 api on crmAutocomplete and give some love to this feature too.

Could you give me the url, so I can check directly?

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

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: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
February 14, 2012, 09:52:04 am
The URL:
https://www.nonprofitoregon.org/civicrm/event/register?id=109&reset=1

The video showing behavior:
http://www.youtube.com/watch?v=aAXEfqtSJhw&feature=youtu.be

Thanks!
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: After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working
February 14, 2012, 10:16:54 am
Hi,

I don't know what was the problem before (probably a different one, they like to stack upon each other, don't they?)

Anyway, now the issue is that an anonymous user can't access the rest interface (obviously, you don't want having anonymous getting access to your list of contacts).

https://www.nonprofitoregon.org/civicrm/ajax/rest?rowCount=35&json=1&fnName=civicrm/contact/search&contact_type=Organization&version=2&return[sort_name]&return[email]&&s=g&limit=25&timestamp=1329242805035&sort_name=g

On the 4 branch we have introduced a new access AJAX API that makes it easier to punch a hole into it and allow anonymous to only get the list of organisations

The solution I can think of right now if to write a simple module that implement /custom/ajax/org is a wrap up around CRM_Utils_REST::ajax accessible to anonymous and forces the parameters to be contact.get & organisations

X+
-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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • After upgrade to 3.4.8 from 3.3.6, rest.js Autocomplete is not working

This forum was archived on 2017-11-26.