Skip to content

Commit

Permalink
added trim on input value (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
jandsonrj authored Aug 16, 2023
1 parent c453ade commit 09e76de
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions frontend/components/newProduct/Step3.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ export function InputReadOnly({ name, value, onClear }) {
InputProps={
onClear !== undefined
? {
endAdornment: (
<InputAdornment position="end">
<IconButton onClick={onClear}>
<CloseIcon />
</IconButton>
</InputAdornment>
)
}
endAdornment: (
<InputAdornment position="end">
<IconButton onClick={onClear}>
<CloseIcon />
</IconButton>
</InputAdornment>
)
}
: null
}
/>
Expand Down Expand Up @@ -124,8 +124,11 @@ export function InputAlias({ pc, onChange, onChangeInputType }) {
)

const handleChange = e => {
setValue(e.target.value)
delayedEdit(pc, e.target.value)
const inputValue = e.target.value
if (inputValue.trim() !== '') {
setValue(inputValue)
delayedEdit(pc, inputValue)
}
}

const handleClear = () => {
Expand Down

0 comments on commit 09e76de

Please sign in to comment.