Saving node form that fails validation results in no unlock button or message

Created on 19 August 2018, almost 6 years ago
Updated 25 April 2024, 2 months ago

Problem/Motivation

This may also occur on other forms but I've only been able to test on a node form.

Steps to reproduce:
1) Configure js locking.
2) Edit a node with locking enabled that has a required field (one without HTML required support, e.g a text long)
3) Save the node form without filling in the required field
4) Form reloads with required error message but no Unlock button or message.

This seems to be due to this chunk of code in content_lock_form_alter().

    $userInput = $form_state->getUserInput();
    if (!empty($userInput)) {
      return;
    }

Proposed resolution

??

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia acbramley

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • First commit to issue fork.
  • Pipeline finished with Failed
    3 months ago
    Total: 229s
    #129119
  • Pipeline finished with Failed
    3 months ago
    Total: 227s
    #129122
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Am able to replicate the issue. Would assume using $form_state->hasAnyErrors() would work but $form_state is showing no errors even when there are.

  • First commit to issue fork.
  • Pipeline finished with Failed
    2 months ago
    Total: 1424s
    #148806
  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    I've rebased this with HEAD; but I haven't been able to reproduce this with HEAD.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    I could reproduce the problem with a field with custom validation (OP says one without HTML required support, e.g a text long, but text log have required support now?).

    Also, the problem happens only with JS-enabled locking, so modified STR.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    @smurtgrave You said you reproduced it, could you add concrete steps to reproduce?
    I could too, but only when having a custom field with custom validation, which is probably a lot of work and overkill for a test here. Maybe your STR are more simple?

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Not directly in front of my computer but I reproduced it with a media reference field.

Production build 0.69.0 2024