When trying to add a counter for the text area using count min functionality (i.e "%d characters/word(s) entered"), you cannot save the element without filling in Count max, which will end up using count max functionality, not min

Based on the snippet below, the intended behavior is correct, but there's another validation done in validateConfigurationForm which doesn't check for counter_minimum. Attaching a patch.

$form['validation']['counter_container']['counter_maximum'] = [
      '#type' => 'number',
      '#title' => $this->t('Count maximum'),
      '#min' => 1,
      '#states' => [
        'required' => [
          ':input[name="properties[counter_type]"]' => ['!value' => ''],
          ':input[name="properties[counter_minimum]"]' => ['value' => ''],
        ],
      ],
    ];

Comments

dragos-dumi created an issue. See original summary.

dragos-dumi’s picture

dragos-dumi’s picture

Status: Active » Needs review

  • jrockowitz committed c11ee1a on 8.x-5.x authored by dragos-dumi
    Issue #3020568 by dragos-dumi: Textarea Count functionality: allow using...
jrockowitz’s picture

Good catch! Thanks for the patch.

jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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