Skip to content

Default values for max property depending on field type? #387

@RKlingler

Description

@RKlingler

When I enter a long text into a field with the type "Text", I get the following error message when saving the content element:

SQL error: "An exception occurred while executing a query: Data too long for column 'some_field' at row 1"

Database columns for text fields are by default created as VARCHAR - which is fine. When using the default TYPO3 fields like header, subheader, etc. the backend form automatically makes sure I don't enter text that is longer than the database can store. It does that by adding a maxlength attribute and a character count below the field. On custom fields, this doesn't seem to be the case though.

I could circumvent the issue by adding max: 255 to every custom field I define, which would solve the issue. However, it would be quite tedious to update and maintain all of the field definitions.

Would it be possible and beneficial to make 255 the default value of the max property on "Text" fields (and maybe others accordingly) so that custom fields behave like the default TYPO3 fields, in this regard?

I'm using Content Blocks 0.7 with TYPO2 12. I didn't test this on a more up to date version, but judging by the documentation I assume there is also no default max value in never versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions