I am creating a Webform (with CiviCRM) attached to a node programmatically. When the function is invoked the node is created, the webform is created, the webform is associated with the node reference, and then I pace data into the Webform. To get data into the Webform I use webform_submission->setData($data);. In this case $data is an array with key values. For example, something like this

  $data = [
    'drupal_uid' => $uid,
    'civicrm_id' => $civicrm_id,
    'language' => $language_id,
    'event_id' => $event_id,
    'membership_type_id' => $membership_type_id,

In my code I also have civicrm_1_participant_1_participant_event_id. When I fill this field with the event ID from CiviCRM it does not change the displayed value of the field. If I run through the form when not initiating it with my code I get a value like "114-12". I know that 114 is the event ID but I do not know what 12 is.

My goal is for this field to show the event the contact is getting signed up for before they press next to pay. Knowing what the 12 is might be enough for me to populate the correct value.

Thanks, Josh

  • sorry, I can't help you. we have only ever done this by putting the eventID in the url
    – petednz - fuzion
    May 2, 2022 at 19:32
  • @petednz, thanks for the reply. Do you have any idea what the number being appended with the dash is. It might help me figure out how to unwrap this? Thanks!
    – Josh
    May 4, 2022 at 14:54
  • is 12 the membership type id? or participant id?
    – petednz - fuzion
    May 5, 2022 at 8:06
  • @fuzion, It is not either of those things. I am trying to figure this out now.
    – Josh
    May 15, 2022 at 19:38


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.