6.0 Paid Event Example
Create an event in CiviCRM>Events>New Event For more information on creating events visit Civi Event Documentation
Also note that Webform CiviCRM does not support price sets, you will need to use participant fees to collect money for your event.
Create your webform as shown in Getting Started and keep in mind the steps we went through in our Contribution Webform Example
So once the Event (in this example it is called Workshop) and the Contribution page (is this example it is called donation) are created, you are ready to create your webform as shown in Basic Webform
CiviCRM Configuration Form¶
Open your basic webform - Structure > Webform > Basic Webform > Settings > CiviCRM
We have enabled first name, last name and e-mail fields.
Under the Event Registration section on the left, for Registration Method, you want to select register each contact separately
Under the Additional options section on the left, we have Source Label Event Example. This makes it eary to track contributions related to the the event.
View¶
Here is the View of our form
Test¶
Testing our form shows the following
Build¶
Here is the Build of the form
If you go to Form>Settings>CSS/JS we have written a conditional to calculate the Participant Fee. If the registrant clicks the workshop checkbox, this coding below autofills the registration fee to $25.
(function ($) {
Drupal.behaviors.officeHours = {
attach: function (context, settings) {
// Sep
$('#edit-civicrm-1-participant-1-participant-event-id').change(function() {
if($("#edit-civicrm-1-participant-1-participant-event-id").is(':checked')) {
$("#edit-civicrm-1-participant-1-participant-fee-amount").val('25');
}
if(!$("#edit-civicrm-1-participant-1-participant-event-id").is(':checked')) {
$("#edit-civicrm-1-participant-1-participant-fee-amount").val('0');
}
});
}
};
})(jQuery);
Form YAML¶
wizard_page:
'#type': wizard_page
'#title': wizard-page
civicrm_1_contact_1_fieldset_fieldset:
'#type': fieldset
'#title': 'Contact 1'
'#form_key': civicrm_1_contact_1_fieldset_fieldset
civicrm_1_contact_1_contact_first_name:
'#type': textfield
'#contact_type': individual
'#form_key': civicrm_1_contact_1_contact_first_name
'#extra':
width: 20
'#parent': civicrm_1_contact_1_fieldset_fieldset
'#title': 'First Name'
civicrm_1_contact_1_contact_last_name:
'#type': textfield
'#contact_type': individual
'#form_key': civicrm_1_contact_1_contact_last_name
'#extra':
width: 20
'#parent': civicrm_1_contact_1_fieldset_fieldset
'#title': 'Last Name'
civicrm_1_contact_1_email_email:
'#type': email
'#form_key': civicrm_1_contact_1_email_email
'#extra':
width: 20
'#parent': civicrm_1_contact_1_fieldset_fieldset
'#title': Email
civicrm_1_participant_1_participant_event_id:
'#type': civicrm_options
'#title': Event(s)
'#civicrm_live_options': 0
'#options':
4-6: Workshop
'#format_items': ul
'#format_items_html': ''
'#format_items_text': ''
'#extra':
aslist: 0
multiple: 1
'#form_key': civicrm_1_participant_1_participant_event_id
'#parent': civicrm_1_contact_1_fieldset_fieldset
'#default_option': false
'#default_value': false
civicrm_1_participant_1_participant_fee_amount:
'#type': number
'#data_type': Money
'#extra':
field_prefix: $
point: .
separator: ','
decimals: 2
min: 0
'#form_key': civicrm_1_participant_1_participant_fee_amount
'#parent': civicrm_1_contact_1_fieldset_fieldset
'#title': 'Participant Fee'
contribution_pagebreak:
'#type': wizard_page
'#form_key': contribution_pagebreak
'#title': Payment
civicrm_1_contribution_1_contribution_contribution_page_id:
'#type': hidden
'#expose_list': true
'#empty_option': None
'#extra':
hidden_type: hidden
'#parent': contribution_pagebreak
'#form_key': civicrm_1_contribution_1_contribution_contribution_page_id
'#value': '2'
'#title': 'Contribution Page'