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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • API newbie: how can my script get user input?
Pages: [1]

Author Topic: API newbie: how can my script get user input?  (Read 1589 times)

m.e.

  • I post frequently
  • ***
  • Posts: 157
  • Karma: 5
  • CiviCRM version: 4.0.9
  • CMS version: Drupal 7.9
API newbie: how can my script get user input?
October 05, 2010, 07:11:07 pm
Is there a way to give the site visitor an input choice that would direct how my snippet queried the DB (for example, user picks a state out of a dropdown list, and the query pulls contacts from that state only). In a regular PHP script the page would have many "states" depending on whether it had just loaded, just received input, or determined an error. What would be the mechanism for receiving user data from a form field in a CiviCRM Drupal installation?

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: API newbie: how can my script get user input?
October 05, 2010, 11:31:05 pm
The example you gave I would solve with standard CiviCRM functionality, by creating groups or tags? Can you do that and use that set up to retrieve the information?
http://en.flossmanuals.net/CiviCRM/GroupsAndTags
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: API newbie: how can my script get user input?
October 06, 2010, 02:17:46 am
Quote from: m.e. on October 05, 2010, 07:11:07 pm
What would be the mechanism for receiving user data from a form field in a CiviCRM Drupal installation?

The mechanism is the CiviCRM+Public+APIs. You probably want the AJAX interface.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

m.e.

  • I post frequently
  • ***
  • Posts: 157
  • Karma: 5
  • CiviCRM version: 4.0.9
  • CMS version: Drupal 7.9
Re: API newbie: how can my script get user input?
October 06, 2010, 08:34:58 am
Hershel, I don't get anything on the CiviCRM + Public + APIs link. Can you resend that?

Erik, I don't want to give casual site visitors access to CiviCRM menus. I was planning to give many search/filtering options and then display totals and other info as content.

Thanks!

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: API newbie: how can my script get user input?
October 06, 2010, 08:37:19 am
Link got messed up. Sorry. Here it is: http://wiki.civicrm.org/confluence/display/CRMDOC32/CiviCRM+Public+APIs

CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: API newbie: how can my script get user input?
October 06, 2010, 10:03:00 am
That makes sense, I was not clear as to what you are trying to achieve, sorry about that  ;D. Hershel is right, use the API's, directly if you are on the same server and with the REST if you are on another server.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

m.e.

  • I post frequently
  • ***
  • Posts: 157
  • Karma: 5
  • CiviCRM version: 4.0.9
  • CMS version: Drupal 7.9
Re: API newbie: how can my script get user input?
October 06, 2010, 10:08:15 am
OK, thanks. Sounds as if I need to read up on Ajax and then format links as per the following example in the Wiki - ?

http://example.org/civicrm/ajax/rest/civicrm/ajax/rest?fnName=civicrm/contact/search&json=1&contact_type=Organization&rowCount=25&return[country]&tag=40&sort_name=test

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: API newbie: how can my script get user input?
October 06, 2010, 10:23:59 am
I recommend you read the chapter on the API's first:
http://en.flossmanuals.net/CiviCRM/DevelopAPI
And if you have any questions after reading that, shoot :-)
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • API newbie: how can my script get user input?

This forum was archived on 2017-11-26.