Multiple fields remove button fails for Smart Date field with Recurrence enabled

Created on 25 October 2021, about 3 years ago
Updated 10 May 2024, 6 months ago

Problem/Motivation

The Multiple Fields Remove button module does not work for Smart Date field with Recurrence enabled.

Steps to reproduce

  1. Install the Smart Date module and Smart Date Recurring module
  2. Create a Smart Date range field with Recurring option enabled and Allowed number of values as Unlimited in a Content type
  3. Install the Multiple fields remove button module
  4. Create a node of prior mentioned content type which has a Smart Date range field with multiple values
  5. Save the content, edit it and try removing any of the recurrence values from within the Smart Date field. The field does not get deleted.

Proposed resolution

The multiple fields remove button's submit handler fetches the delta of the delete button pressed and tries to loop sequentially over available recurrences to push them back by one place over the deleted element. However, for a Smart Date field with recurrence enabled the delta value of each field of recurrence element does not appear to be sequential. Also the items_count value in the widget's field_state provides a value different from the total count of items. Both of these negate the shifting logic responsible for the delete functionality to work. However for a Smart Date field without recurrence enabled the delta values are in sequence and work as intended. Requesting suggestions on how to get the Smart Date with Recurrence enabled to work with multiple fields remove button module.

Feature request
Status

Active

Version

3.5

Component

Smart Date Recur

Created by

🇮🇳India optimusprime619

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia tisteegz

    Experiencing this issue also.

    Drupal: 9.5.9
    Smart date: 4.0.2
    Multiple Fields Remove Button: 8.x-2.2

    When I go to remove a date with a recurring date rule it just says 'please wait...' and then nothing happens. No error, just doesn't remove it.

  • 🇪🇸Spain intersarsi

    I recently installed the module with this configuration and it works for me:

    Drupal 10.0.9
    Smart Date 4.0.2
    Multiple Fields Remove Button 8.x-2.2

  • This issue is reproducible in Smart Date 4.0.3, but I noticed that the patch provided by @mandclu partially applies and the partial application fixes the issue. Here is a new version of the patch with the change to SmartDateWidgetBase.php that was in the original patch but was not changed in the source code.

    Note that this issue is also reproducible in 4.1.0-rc6. I tried updating in case it would resolve the issue but it didn't, and the patch is not compatible with that version. The only resolution that has worked for me has been to use version 4.0.3 and apply the change to SmartDateWidgetBase.php that was in the original patch.

  • 🇩🇪Germany tobiasb Berlin
Production build 0.71.5 2024