Skip to content

Trim values automatically in a form submission #16469

@44dhi

Description

@44dhi

Describe the problem

Recently, a company I work with gave us a sprint ticket to add trimming to all values submitted via a form throughout the whole project. It took us a lot of useful hours to track down and identify all the text inputs which needed to be trimmed before form submission.

A colleague of mine suggested to write a high order function that will iterate through the request body and trim out the values of type string.

Describe the proposed solution

This got me thinking to have a custom prop on svelte form elements that can automatically trim values on submit. A prop like autoTrim can be introduced on form tags that will automatically all values before passing invoking the onSubmit or action.

Importance

would make my life easier

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions