Body: <p>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-&gt;setData($data);. In this case $data is an array with key values. For example, something like this</p>
  <pre><code>  $data = [
      'drupal_uid' =&gt; $uid,
      'civicrm_id' =&gt; $civicrm_id,
      'language' =&gt; $language_id,
      'event_id' =&gt; $event_id,
      'membership_type_id' =&gt; $membership_type_id,
  ];
  </code></pre>
  <p>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 &quot;114-12&quot;. I know that 114 is the event ID but I do not know what 12 is.</p>
  <p>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.</p>
  <p>Thanks,
  Josh</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-02T19:32:23.073Z
Comments.Text: sorry, I can't help you. we have only ever done this by putting the eventID in the url
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-04T14:54:32.200Z
Comments.Text: @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!
Comments.UserDisplayName: Josh
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-05T08:06:55.893Z
Comments.Text: is 12 the membership type id? or participant id?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-15T19:38:12.937Z
Comments.Text: @fuzion, It is not either of those things. I am trying to figure this out now.
Comments.UserDisplayName: Josh
Tags: <webform-civicrm>
Title: Cannot Pre-fill Event in Webform
ThreadText: # Cannot Pre-fill Event in Webform
  
  (Asked by: username_0 on 2022-05-01)
  
  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,
  username_0
  
  **Tags:** webform-civicrm
  
  > **Comments:**
  > **username_1**: sorry, I can't help you. we have only ever done this by putting the eventID in the url  
  > **username_0**: @username_1, 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!  
  > **username_1**: is 12 the membership type id? or participant id?  
  > **username_0**: @username_1, It is not either of those things. I am trying to figure this out now.  
  
  ---
  
  ## 0 answers
  
  