Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero in Textfield with readonlyTransformation shows ('none') #11584

Open
2 tasks done
nick-zooma opened this issue Jan 29, 2025 · 3 comments
Open
2 tasks done

Zero in Textfield with readonlyTransformation shows ('none') #11584

nick-zooma opened this issue Jan 29, 2025 · 3 comments

Comments

@nick-zooma
Copy link

nick-zooma commented Jan 29, 2025

Module version(s) affected

5.3.3

Description

In a textfield with int value 0, or string value '0' transformed with performReadonlyTransformation shows ('none')
Image

How to reproduce

Code Sample

(TextField('Zero', 'Zero', 0))->performReadonlyTransformation()

(TextField('Zero', 'Zero', '0'))->performReadonlyTransformation()

Possible Solution

No response

Additional Context

No response

Validations

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)
@GuySartorelli
Copy link
Member

It's hard to distinguish between "0 as a default integer value for a DBInt or DBPrimaryKey etc which literally means no value has been set" and "0 as an intentional value for a DBVarchar or similar which is a value value".

I'd be interested in what solution you'd recommend implementing here that accounts for both scenarios.

@NickStijger
Copy link

I would expect that null is used as unset value and not 0

@GuySartorelli
Copy link
Member

That doesn't cover DBInt and DBPrimary key usages of the field, for which 0 is the "unset" value by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants