Plain text field not showing value when value is 0

Created on 15 February 2025, 2 months ago

Problem/Motivation

When using a plain text field and inputting a string value of "0", the table does not render the value in the display. Instead it renders empty <td> </td> tags.

Steps to reproduce

  1. Create a new datafield field
  2. Create a new plain text field / column in the datafield field
  3. Enter the value of "0" in the input field when editing the entity
  4. View the entity
🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇨🇦Canada chrisck BC, Canada

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

Comments & Activities

  • Issue created by @chrisck
  • 🇨🇦Canada chrisck BC, Canada
    • lazzyvn committed 9632f415 on 2.x
      Issue #3506883: Plain text field not showing value when value is 0
      
  • 🇨🇦Canada chrisck BC, Canada

    @lazzyvn I don't think this issue is fixed. I've just tested this on the latest 2.0.9 release that has your latest commit in it.

  • 🇫🇷France lazzyvn paris

    Clear cache maybe?
    tested on my drupal it works fine

  • 🇨🇦Canada chrisck BC, Canada

    Clearing cache did not fix it. However, going to Manage display and changing the Format from Table to something else, and then back to Table fixed it. I think it required a saving of the Manage display.

  • 🇫🇷France lazzyvn paris

    you didn't read the module instructions step 3?

  • 🇨🇦Canada chrisck BC, Canada

    Please follow these steps to reproduce:

    1. Create taxonomy vocabulary Alphabet
    2. Create three taxonomy terms in Alphabet: "A", "B", "C"
    3. Add a new data field to Basic page content type
    4. Leave the first data row as machine name value with Type: Text (plain)
    5. Add another data row as machine name alphabet with Type: Entity reference
    6. Configure Alphabet data row Entity reference type: Taxonomy term and Vocabulary: Alphabet
    7. Save settings
    8. Create new Basic page with "0" value in plain text and select a taxonomy term for Alphabet
    9. By default, "0" value will display in plain text, but the taxonomy term will show the term ID
    10. Go to Manage display for Basic page and click on the "cog wheel" to open up field formatter settings for Table, change nothing and "Update" field formatter Table
    11. Save the Manage display page
    12. View your Basic page and see the "0" value is missing, but now the taxonomy term name is showing.
  • 🇫🇷France lazzyvn paris

    you didn't read the module instructions step 4? It must config field settings, widget, formatter before use. If you can't, you can hire an drupal expert who can find the error in your case and send a patch to fix.

  • 🇨🇦Canada chrisck BC, Canada

    I have read all instructions included with the module and have set the field widget and field display. I'm reporting a bug. If you follow steps to reproduce you will see.

    • lazzyvn committed 8c93c844 on 2.x
      Issue #3506883 by lazzyvn: Plain text field not showing value when value...
  • 🇫🇷France lazzyvn paris

    You can change annother formatter type it wil show 0. btw it fixed in dev version for default string formatter

  • 🇨🇦Canada chrisck BC, Canada

    @lazzyvn Tested the latest release 2.0.10 and this is fixed, thank you!

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

Production build 0.71.5 2024