Form field actions for multi-property fields

Created on 26 April 2023, over 1 year ago
Updated 1 May 2023, over 1 year ago

Problem/Motivation

What is a problem for some is right for others. Field states cannot be set in multi-valued fields (date range) after update. How to set field state as disabled in multivalued fields? myfield.0.value and myfield.0.end_value are not working.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.2

Component

Documentation

Created by

🇵🇱Poland mdnsoft

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

Comments & Activities

  • Issue created by @mdnsoft
  • Assigned to mxh
  • 🇩🇪Germany mxh Offenburg

    Thanks for the report. This rather looks like a bug that got introduced from the linked parent issue. I can have a look at it this evening or tomorrow.

    Meanwhile, you'd need to use the previously working version until this got fixed.

    What could help speeding this up, is an export of your affected model configuration. Each ECA config has an export link at the listing page. If that's part of a bigger model, creating a smaller one that only contains the relevant part would be highly appreciated.

  • 🇩🇪Germany mxh Offenburg

    Hm, I can confirm the problem, however I get the same problem using either one of 1.1.1, 1.1.2 or 1.1.3.

    Which version was the one that worked for you before, since you posted something about "after update"?

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    271 pass
  • @mxh opened merge request.
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    284 pass
  • @mxh opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇩🇪Germany mxh Offenburg

    The lookup function is currently not finding the targeted element of a multi-column field when #parents / #array_parents are not yet set. This is the case wit the date range field, as it seems that it's being inserted into the form array a bit late. I've adjusted the lookup function a bit, so that it should also be able to find the targeted element, even when the form array has a "widget" key in-between of it.

  • 🇵🇱Poland mdnsoft

    Thanks for the info.
    In version 1.1.2 it worked as expected - I needed to disable one field (start date) in a multivalued field - date range. I just gave the machine name of the field - that was enough for me. After update, it disables both fields (start date and end date). So far, I have not used myfield.0.value syntax. In the parent issue #3346508 🐛 eca_form: Form field actions are not working well for multi-property fields Fixed there was a description that this correctly selects the desired fields.

  • 🇩🇪Germany mxh Offenburg

    Thanks for the update, that explains why it worked before on your config. However, using the more specific syntax to disable a certain element (like field_mydate.0.value) is supposed to be the correct approach. Just specifying field_mydate is supposed to disable the whole field widget.

    If you have time to try out the merge request, it would be highly appreciated and may speed things up to fix this issue.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Reviewed the patches and the code looks good. @mxh the difference of the 2 patches is just the line numbers, right? I think, each patch should therefore work in both branches, but never mind, it's good to have them both.

    @mdnsoft before we merge this, could you please confirm if this resolves your issue and if so, set the status of this issue to RTBC?

  • 🇩🇪Germany mxh Offenburg

    @jurgenhaas Yes both MR are basically identical. I was just writing the patch for 1.1.x first this time, and then just pushed it. MR351 could probably be dropped in case we have some work left to do for avoiding mistakes due to redundant commits.

  • 🇵🇱Poland mdnsoft

    I checked the effect after the patches - unfortunately it still does not work. The first field (value) cannot be disabled at all. However, it is possible to disable the second field (end_value). However, the syntax field.end_value and field.0.end_value do not work. Fields can be disabled using the syntax field:end_value and field:0:end_value.
    I attach model configuration.

  • 🇵🇱Poland mdnsoft

    It's weird, I created a new field and a new model and everything is fine. Even weirder, it now works on the old field as well - syntax field.0.value / field.0.end_value. The syntax I wrote about previously does not work. I'm confused.

  • Assigned to mxh
  • Status changed to Needs work over 1 year ago
  • 🇩🇪Germany mxh Offenburg

    Confirming that using ":" instead of "." does not work. It's most probably due to a bug in the validation of the field name input. Will have a look.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    284 pass
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    271 pass
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇩🇪Germany mxh Offenburg

    This should be now ready for another try using ":" as a separator.

  • 🇵🇱Poland mdnsoft

    Works ":" as well as "."

  • Status changed to RTBC over 1 year ago
  • 🇩🇪Germany mxh Offenburg

    Thanks for the feedback, that's great news.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    284 pass
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    284 pass
  • Status changed to Fixed over 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Great work everyone, thanks so much.

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

Production build 0.71.5 2024