Allow to remove values that weren't submitted

Created on 15 June 2023, over 1 year ago
Updated 16 June 2023, over 1 year ago

Problem/Motivation

Can't remove data from the fields if they weren't submitted yet

Steps to reproduce

1. Open an entity add form where you have an Office Hours field.
2. Add values in the "From"/"To"/Comment" fields.
3. "Remove" button isn't shown on the form so you should clear all the fields one by one.

Same behavior with an entity edit form.

In addition, the button should not be hidden after the click so it could be used multiple times.

Proposed resolution

Don't use the if (!OfficeHoursItem::isValueEmpty($value)) condition for the "Remove" button.

User interface changes

The "Remove" button will be always shown on a form.

✨ Feature request
Status

Fixed

Version

1.11

Component

User interface

Created by

πŸ‡ΊπŸ‡¦Ukraine paulrad

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

Comments & Activities

  • Issue created by @paulrad
  • Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    Waiting for branch to pass
  • @paulrad opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    Waiting for branch to pass
  • πŸ‡ΊπŸ‡¦Ukraine paulrad

    Patch with proposed changes.

  • Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    Waiting for branch to pass
  • Status changed to Fixed over 1 year ago
  • πŸ‡³πŸ‡±Netherlands johnv

    That seems reasonable.
    Committed your proposal.

    From your point of view, is this a regression error? Or a feature request?

    It would be nice if the linek shows automatically, when user enters some data in a time slot.OTOH, that might be a confusing UX.

  • Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    Waiting for branch to pass
  • πŸ‡ΊπŸ‡¦Ukraine paulrad

    johnv, I'm not sure cause this logic was explicitly predefined and maybe had some purpose I didn't meet in my project.

    I also thought that the button label could be changed for something like "Remove" if the value is saved in the field and "Clear" for newly added/edited data.

  • πŸ‡³πŸ‡±Netherlands johnv

    In the past, I did change the caption, using as many Drupal core translations.
    So it could be that I change 'Clear' to 'Remove'.
    Indeed, 'Clear' better covers the functionality.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024