Add support for TextField auto-trim
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.8k
- Forks
- 717
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 3
Description
Originally by mvysny2
A setter e.g. TextField.setAutoTrim(true) will be very helpful.
Recently I encountered a bug in the user registration form, where users inputted their username as "foo "; the TextField was directly bound to a JPA bean and that trailing space made it into the database. The login dialog correctly trimmed the username field and as you can imagine, the user couldn't log in :-)
I know I can probably do this with a proper converter, yet a setter would be more helpful: it is way shorter and can be set from design html file.
Thank you :)
Imported from https://dev.vaadin.com/ issue #19680
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the TextField component and its existing value, binding, and converter behavior. Review how component properties can be configured from a design HTML file. Done means TextField.setAutoTrim(true) is available and trailing spaces are removed before the value reaches the bound JPA bean, with the behavior covered by relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100