Undefined array key / offset value errors

Created on 4 October 2024, 4 months ago

Problem/Motivation

Hello - I'm seeking support on three errors I'm getting while using this module.
Drupal version 10.3.5

I've created a View with a few taxonomy items rendered into a JSON endpoint. This is working because I can view the endpoint in the browser.

I set up this module. In my webform, I added a remote select. I configured the API endpoint. I've tried both filling and not filling in the keys fields. I'm getting errors no matter how I configure it.

Warning: Undefined array key "select_date_ranges" in Drupal\webform_remote_select\Element\WebformRemoteSelectElement::processSelect() (line 83 of modules\contrib\webform_remote_select\src\Element\WebformRemoteSelectElement.php).

Error message
Warning: Trying to access array offset on value of type null in Drupal\webform_remote_select\Element\WebformRemoteSelectElement::processSelect() (line 83 of modules\contrib\webform_remote_select\src\Element\WebformRemoteSelectElement.php).

Error message
Warning: Undefined array key "#use_empty_option" in Drupal\webform_remote_select\Element\WebformRemoteSelectElement::processSelect() (line 85 of modules\contrib\webform_remote_select\src\Element\WebformRemoteSelectElement.php).

Steps to reproduce

Build a Drupal 10.3.5 site with webform module. Add and enable this module. Enable RESTful web services and serialization.
Create a view with some sort of content. Render as a JSON endpoint and test.
Create a webform with remote select. Point to the JSON endpoint.

Seeking suggestions on how to troubleshoot these errors.

๐Ÿ’ฌ Support request
Status

Active

Version

1.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States rraney

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

Merge Requests

Comments & Activities

  • Issue created by @rraney
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia mohd sahzad

    mohd sahzad โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    4 months ago
    Total: 171s
    #302665
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia mohd sahzad

    Hello @rraney,

    The issue regarding the warning for the undefined array key "#use_empty_option" has been resolved. However, we are unable to reproduce the warning for the undefined array key "select_date_ranges".

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States rraney

    I did not get this to work, but perhaps the issue was somewhere in the key/value configurations. I don't think it's clear how to configure these or what it's looking for. I created my own solution with JavaScript so I'm moving on. Perhaps it's necessary (as with my own solution) to use item.key[0].valuesince fetching JSON often involves arrays. For example, in JavaScript:

    option.value = item.field_start_date[0].value;
          option.text = item.name[0].value;
Production build 0.71.5 2024