Problem/Motivation

Due to a recent version upgrade, all of a sudden a "Remove" button started appearing on the repeat settings:
the new 'remove' button

But if repeat="never", then this button doesn't do anything when you click it (the repeat-section of the form reloads and displays the same thing). This just adds confusion: "What would this remove? Will it clear out the entire date field?"

Steps to reproduce

1. Set up a smart date field to allow recurrence
2. create/edit an entity with the field
3. immediately hit "Remove". Observe the reload, but nothing has changed
4. Set the recurrence to something other than "never"
5. hi "Remove". Observe that the recurrence settings were removed

Proposed resolution

"Remove" should only appear if repeat!="never"

CommentFileSizeAuthor
Screenshot 2026-10-13 at 4.04.34 PM.png61.89 KBdalin

Issue fork smart_date-3630720

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dalin created an issue. See original summary.

adityarawat_ln made their first commit to this issue’s fork.

adityarawat_ln’s picture

Status: Active » Needs review

I reproduced the issue and implemented a proposed fix.

The Remove button is now controlled by the Repeat selection:
- When Repeat is set to Never, the Remove button is hidden.
- When a recurrence option other than Never is selected, the Remove button is displayed.

This uses Drupal Form API states to update the button's visibility dynamically when the Repeat selection changes.

I have created a merge request with the proposed changes. Feedback and testing are welcome.

Thank you