Autocompletion of existing contact field breaks under certain conditions

Created on 4 July 2024, 6 months ago

Problem/Motivation

The autocompletion of the existing contact feature breaks under the following conditions:

  • It appears after an upload field
  • The form submission fails, e.g., because registering for an event in the past
<!--break-->

Detailed steps to reproduce

Create a new webform, then:

Add existing contact

  1. Go to CiviCRM
  2. Check Enable CiviCRM Processing
  3. Number of Contacts: 1
  4. Under 1. Contact 1Contact Fields Make sure that Existing Contact is checked
  5. Under 1. Contact 1Contact Fields Check Upload Image
  6. Click Save Settings

Give the form a reason to fail

  1. Go to CiviCRM
  2. Under Event Registration, select Show Past EventsAll, make sure that Prevent Registration for Past/Full Events is checked and select a past event
  3. Click Save Settings

Enable autocompletion

  1. Go to Build
  2. Edit Existing Contact
  3. Set Form displayForm Widget to Autocomplete
  4. Click Save

Move existing contact field to the bottom

  1. Go to Build
  2. Move the existing contact field below the upload image field
  3. Click Save

Make form available

  1. Go to Settings
  2. Set URL path settingsWebform URL alias, e.g., to /test
  3. Click Save

Fill form and notice error

  1. As anonymous user, navigate to the form (e.g., at /test)
  2. Select an image and an existing contact
  3. Submit the form and notice (as expected) that you can no longer register for ...
  4. Notice that the existing contact is not filled anymore
  5. Notice that now upon typing in the existing contact field, requests are sent to https://drupal.example.org/webform-civicrm/js/form_id/undefined?str=search_query (notice the undefined) and fail.
  6. Notice Drupal log messages saying access denied because of the invalid search completion URL
🐛 Bug report
Status

Active

Version

6.2

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024