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) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 4.3 Release Testing (Moderator: pdelbar) »
  • Quick search -- trying to forward to advanced search page instead of basic searc
Pages: [1]

Author Topic: Quick search -- trying to forward to advanced search page instead of basic searc  (Read 1008 times)

Laryn

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 4
    • CEDC
  • CiviCRM version: 4.6.x
  • CMS version: Drupal 7
Quick search -- trying to forward to advanced search page instead of basic searc
March 11, 2013, 07:41:59 pm
I was getting some pointers from colemanw the other day in my quest to get the Quicksearch to forward to the advanced search page with the values prefilled if the user presses enter instead of just waiting for results to populate (and ideally it would have performed the search already when the advanced search page loads). I ran into a few problems and wondered if anyone had input.

You can see what I am working on here:
  • Quick search branch on GitHub

This populates (for example) the external ID or phone field, but gives a fatal error for CiviCRM id (which seems to be because within searches, 'id' means 'profile id' and not 'civicrm id'). Anybody have advice on the two big issues remaining:
  • Getting the ID field into the ID field on the advanced search page (or at least avoiding the fatal error)
  • Getting the advanced search to automatically run

Thanks!
CEDC...social justice by design

*Get support on the new CiviCRM help site. /laryn

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Quick search -- trying to forward to advanced search page instead of basic searc
March 11, 2013, 07:54:10 pm
Kudos for working on this!
Modifying the name of the field is clever. You could do an if statement in your javascript like:
value = value == 'id' ? 'contact_id' : value;
to fudge it.
That click handler can just be added to the existing one, no reason for two click handlers. And no need to do flushcache and focus twice.
Try asking your question on the new CiviCRM help site.

Laryn

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 4
    • CEDC
  • CiviCRM version: 4.6.x
  • CMS version: Drupal 7
Re: Quick search -- trying to forward to advanced search page instead of basic searc
March 12, 2013, 08:25:59 am
Thanks, Coleman!

I was initially trying to get it into the same click handler, but wasn't enough of a Javascript whiz to figure out how to tell it I was using the input wrapped by the .crm-quickSearchField class and not the wrapping element. I will keep at it and see if I can get it better optimized.

Would there be any reason not to change the name/id of the CiviCRM ID field on the advanced search page to 'contact_id' instead of 'id'?

L.
CEDC...social justice by design

*Get support on the new CiviCRM help site. /laryn

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Quick search -- trying to forward to advanced search page instead of basic searc
March 13, 2013, 09:31:03 am
CiviCRM search functions are a very long and tangled web, code is shared between advanced search, custom searches, search builder, and smart groups. I think renaming a field would be a fairly big job since it touches on so many places in the codebase.
How are you getting along with the code. Let me know when you commit again, or ping us on IRC if you want to discuss more. I think this is a great improvement - let's get it finished this week :)
Try asking your question on the new CiviCRM help site.

Laryn

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 4
    • CEDC
  • CiviCRM version: 4.6.x
  • CMS version: Drupal 7
Re: Quick search -- trying to forward to advanced search page instead of basic searc
March 14, 2013, 02:32:33 pm
Well, I think the code is a little bit more optimized, though it still doesn't handle the 'contact_id' very well, and it doesn't auto submit the advanced search form.

What do you think? Any ideas for improvement?

L.
CEDC...social justice by design

*Get support on the new CiviCRM help site. /laryn

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Quick search -- trying to forward to advanced search page instead of basic searc
March 14, 2013, 09:47:03 pm
FIgured it out. The submit button name needed to be changed to match the one in advanced search instead of basic.
It also needed a hidden field added to make the address fields work, and had to fudge first and last name fields because they do not exist in advanced search.
https://github.com/civicrm/civicrm-core/pull/154
Try asking your question on the new CiviCRM help site.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 4.3 Release Testing (Moderator: pdelbar) »
  • Quick search -- trying to forward to advanced search page instead of basic searc

This forum was archived on 2017-11-26.