Skip to content

Changing a textarea's allowed text format prevents any future edits #7148

@swampopus

Description

@swampopus

Description of the bug

I had a textarea where I was allowing the Filtered text "Basic" text format. I had created a node. Then, I modified the field to only allow the Filtered text format "Plain Text", and suddenly I could no longer edit the field value, even though I was logged in as admin (uid 1).

Steps To Reproduce

To reproduce the behavior:

  1. Create a new Content Type. Mine is called "Testing". Add a text (long) field, which allows Filtered text, and the Basic text format. Go ahead and create a node, like so:
Image
  1. Go back to the Content Type, edit the text (long) field, and change the allowed format to only be "Plain Text". As you can see, I renamed mine to "Plain Text w Line Breaks" for clarity.
Image
  1. Now, edit the node you just created. You can no longer make edits to the textarea:
Image

Expected behavior

I would expect that any existing saved data would appear in the textarea, after having been passed through the selected filter. Or, just run it through check_plain() and display in whatever editor appears.

In my example case, I would expect to see something like:

<p>
Hello, I am a test
</p>

Instead, the textarea is disabled, and I cannot make changes at all, even as admin. Getting to a point where I could actually edit the textarea for this node is actually a bit of a pain (see Workaround below).

Workaround?

The only workaround I could find was to (1) remove the text (long) field from the content type, then (2) re-save the node, then (3) add the text (long) field back in with only "Plain Text" filter selected.

Note: Simply removing and immediately re-adding the field to the content type didn't work; you have to save the node in between.

Obviously this wouldn't be ideal if I'm working on a live site with hundreds of nodes by multiple users. Plus you completely lose any content which was previously there.

Additional information

  • Backdrop CMS version: 1.34.0
  • Web server and its version: Apache 2.4
  • PHP version: 8.3.27
  • Database sever (MySQL or MariaDB?) and its version: MariaDB 10.11.11
  • Operating System and its version: Linux (Synology NAS)
  • Browser(s) and their versions: Chrome v148.0.7778.217

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions