Adding fields to a Registration Form


I am currently developing a plugin to call a payment API. The call to the API is working as expected. Now I have to provide to this API information which are not be part of the registrant’s personal data (i.e. registrant’s VAT number, address with separated fields for street, street number…). Ideally these fields should not be maintained by the conference organizer.

The documentation mentions the event indico.core.signals.event.registration_form_wtform_created. It seems to be a good candidate to provide new fields to the registration form. Unfortunately, it seems that this event is never fired. I try to connect my plugin to this event in the init method:

def init(self):
    self.connect(signals.event.registration_form_wtform_created, self._registration_form_wtform_created)

or with @signals.event.registration_form_wtform_created.connect without success.

Is there another way to add fields to the registration form? I also tried to use event signals.event.registration_form_created :

address_section = RegistrationFormSection(,
                                                      title=_("Address"), is_manager_only=False)

street_field = RegistrationFormField(, registration_form=form,
                                                   title=_("Street"), is_required=True, is_enabled=True, input_type="text",
                                                   data={}, versioned_data={})

but, for me, that’s not the way to go. Am I right?

Best regards,

I think if you don’t need to store these data ( they are needed for payment only and stored with the payment provider) you could implement the fields in the plugin-specific payment form ( template event_payment_form) as well.

1 Like

Indeed, it no longer exists since 3.2, we just forgot to remove it. Anyway, it’s not the right one to use here.

registration_form_created should do the job if you want to add additional fields. I see some problems with your code though:

  • Use the relationships to link instead of IDs (that also makes the adds and flushes unnecessary). registration_form=form instead of; likewise for the parent_id.
  • Do not use i18n markers on registration form field titles. Unless you 1) have translations for these words and 2) really want the language used by the creator of the form to be applied (those labels are saved in the DB as strings, so any i18n markers are lost and will NOT be evaluated at display time)

However, I do not think you should be collecting this data as part of the registration form at all. Instead, have the user enter their data on the payment processor’s side since they are probably the only ones who need it while your event organizers probably do NOT need it. You could show some extra fields when rendering the form/button for the payment method. That way you could pass the data to the payment processor but do not need to add it to the registration form itself. Check the payment_cern code in the indico/indico-plugins-cern GitHub repo for an example (we use it to choose the credit card type there).

(edit: oh, somehow I missed @bpedersen2’s reply suggesting basically the same…)

Thank you for your replies and for your recommendations :grinning: !