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 Custom Fields to civiEvent Registration
Pages: [1]

Author Topic: Adding Custom Fields to civiEvent Registration  (Read 928 times)

pwaragoda

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 3.4.4
  • CMS version: Joomla 1.5
  • MySQL version: 5.0.67
  • PHP version: 5.2.17
Adding Custom Fields to civiEvent Registration
March 24, 2013, 08:00:51 am
Hi there,
I want to add more fields to the event registration module civiEvent (please see the attachment). I was wondering whether has anyone in here done that before...
If so how should I approach to solve this issue.
Please advice.
Thank you

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 Custom Fields to civiEvent Registration
March 24, 2013, 09:02:44 am

Might want to read the user guide at http://book.civicrm.org/

You can add more fields via profiles.

If you dont like where they are placed, you can create a custom template and move things around

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

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: Adding Custom Fields to civiEvent Registration
March 25, 2013, 01:32:50 am
Have done that, you can create custom fields and then use a profile to get them added to the event registration screen. As lobo mentioned you could also create your own template. If you have PHP skills you can also use the buildForm hook to add or default custom data on your profile.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

pwaragoda

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 3.4.4
  • CMS version: Joomla 1.5
  • MySQL version: 5.0.67
  • PHP version: 5.2.17
Re: Adding Custom Fields to civiEvent Registration
March 29, 2013, 01:00:33 pm
Hi Donald and Erik, Thank you so much for the advice. I have done what the book suggested and I got those fields to the registration form.
As you guys said, I created a set of custom fields and added them to CiviCRM profile.  But now I ran into another issue.
Now when I try to register for an event (by selecting the custom data) I get a database error

Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`cdrcp_joomla`.`civicrm_value_additional_event_registration_13`, CONSTRAINT `FK_civicrm_value_additional_event_r_4d1eecb391c27197` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_event` (`id`), 1452
Code: [Select]
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [ 'code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_value_additional_event_registration_13  ( are_you_a_35,if_other_then_please_specify_36,are_you_with_a_37,if_other_then_please_specify_you_38,is_your_organization_39,other_40,entity_id ) VALUES ( 'Parent','','Licensed Child Care Centre','','Non-Profit','',44251 ) ON DUPLICATE KEY UPDATE are_you_a_35 = 'Parent',if_other_then_please_specify_36 = '',are_you_with_a_37 = 'Licensed Child Care Centre',if_other_then_please_specify_you_38 = '',is_your_organization_39 = 'Non-Profit',other_40 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`cdrcp392_joomla`.`civicrm_value_additional_event_registration_13`, CONSTRAINT `FK_civicrm_value_additional_event_r_4d1eecb391c27197` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_event` (`id`)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_value_additional_event_registration_13  ( are_you_a_35,if_other_then_please_specify_36,are_you_with_a_37,if_other_then_please_specify_you_38,is_your_organization_39,other_40,entity_id ) VALUES ( 'Parent','','Licensed Child Care Centre','','Non-Profit','',44251 ) ON DUPLICATE KEY UPDATE are_you_a_35 = 'Parent',if_other_then_please_specify_36 = '',are_you_with_a_37 = 'Licensed Child Care Centre',if_other_then_please_specify_you_38 = '',is_your_organization_39 = 'Non-Profit',other_40 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`cdrcp392_joomla`.`civicrm_value_additional_event_registration_13`, CONSTRAINT `FK_civicrm_value_additional_event_r_4d1eecb391c27197` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_event` (`id`)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_value_additional_event_registration_13  ( are_you_a_35,if_other_then_please_specify_36,are_you_with_a_37,if_other_then_please_specify_you_38,is_your_organization_39,other_40,entity_id ) VALUES ( 'Parent','','Licensed Child Care Centre','','Non-Profit','',44251 ) ON DUPLICATE KEY UPDATE are_you_a_35 = 'Parent',if_other_then_please_specify_36 = '',are_you_with_a_37 = 'Licensed Child Care Centre',if_other_then_please_specify_you_38 = '',is_your_organization_39 = 'Non-Profit',other_40 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`cdrcp392_joomla`.`civicrm_value_additional_event_registration_13`, CONSTRAINT `FK_civicrm_value_additional_event_r_4d1eecb391c27197` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_event` (`id`)]"]
)

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 Custom Fields to civiEvent Registration
March 29, 2013, 04:56:22 pm

did u modify your event custom group to participant custom group? how did u do it, via the UI or directly in the DB?

also can u repeat the same experiment and create a new particpant group.

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

pwaragoda

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 3.4.4
  • CMS version: Joomla 1.5
  • MySQL version: 5.0.67
  • PHP version: 5.2.17
Re: Adding Custom Fields to civiEvent Registration
March 31, 2013, 07:21:43 am
Quote from: Donald Lobo on March 29, 2013, 04:56:22 pm

did u modify your event custom group to participant custom group? how did u do it, via the UI or directly in the DB?

also can u repeat the same experiment and create a new particpant group.

lobo


Hi Donald,
Did you mean when I create the custom set of fields, did I update that set from event to participant? if so, yes I did that and I did that using the UI.

What do you mean by creating a new participant group? Sorry I didn't get that

pwaragoda

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 3.4.4
  • CMS version: Joomla 1.5
  • MySQL version: 5.0.67
  • PHP version: 5.2.17
Re: Adding Custom Fields to civiEvent Registration
March 31, 2013, 09:06:47 am
OK GOT IT!. Thx Donald, I created a new set of fields from scratch and now it works fine. Thanks again for your help Donald.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Adding Custom Fields to civiEvent Registration

This forum was archived on 2017-11-26.