Skip to content

Commit

Permalink
Trim inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
camilovegag committed May 22, 2024
1 parent 3e03aed commit bda368e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/berlin/src/pages/Register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,9 @@ function TextInput(props: {
required={!!props.required}
placeholder="Enter a value"
{...props.register(props.id, {
setValueAs: (value) => value.trim(),
validate: (value) => {
if (!props.required) {
if (!props.required && value.trim() === '') {
return true;
}

Expand Down Expand Up @@ -811,8 +812,9 @@ function TextAreaInput(props: {
$required={!!props.required}
placeholder="Enter a value"
{...props.register(props.id, {
setValueAs: (value) => value.trim(),
validate: (value) => {
if (!props.required) {
if (!props.required && value.trim() === '') {
return true;
}

Expand Down

0 comments on commit bda368e

Please sign in to comment.