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) »
  • Adding Form Elements
Pages: [1]

Author Topic: Adding Form Elements  (Read 653 times)

jstn

  • I’m new here
  • *
  • Posts: 10
  • Karma: 0
  • CiviCRM version: 4.0.0
  • CMS version: Drupal 7 Stable
  • MySQL version: Recent Stable?
  • PHP version: PHP 5
Adding Form Elements
January 05, 2012, 08:08:03 am
I can't seem to find the correct way to do this. I've tried this within hook_civicrm_buildForm:

require_once 'HTML/QuickForm/text.php';
$element = new HTML_QuickForm_text('smart_group_title'); //the name is unique and different than what I have here
$form->addElement($element);

The element appears in the $form object but doesn't appear on the page as a text input.

I want to have users be able to change the name/title of a Smart Group as well as edit the search criteria all in one page.

An alternate way to achieve this would be to output only the search criteria and the actions drop-down on a custom page. Is this possible? Is there a CiviCRM function akin to drupal_get_form?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Adding Form Elements
January 05, 2012, 09:55:39 am

you might want to quickly skim thru:

http://book.civicrm.org/developer/

In addition to implementing the hook, u need to customize the template

There is no direct equivalent of drupal_get_form, but adding a wrapper function to have something similar is probably not too hard and will be useful for drupal folks. If interested in working on this please ping us on IRC and we can get u started. Note that civicrm does not use drupal's form api

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Adding Form Elements

This forum was archived on 2017-11-26.