Skip to content

Commit

Permalink
Store NumberInput value without prefix/suffix in hidden field for forms
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Dec 20, 2024
1 parent 857e2d1 commit 9983710
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/widgets/NumberInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ export default class NumberInput extends React.Component {
const minusIcon = this.props.mobile ? "minus" : "chevron-down";
return (
<div className={className + " " + this.props.className}>
<input disabled={this.props.disabled} name={this.props.name}
<input disabled={this.props.disabled}
onBlur={this.commit} onChange={this.onChange}
onFocus={this.setupSelectionListener}
onKeyDown={this.onKeyDown} placeholder={this.props.placeholder}
readOnly={this.props.readOnly} required={this.props.required} step={step}
style={style} type="text" value={this.props.prefix + this.state.value + this.props.suffix} />
<input name={this.props.name} type="hidden" value={this.state.value} />
<Icon icon={plusIcon} onMouseDown={() => this.startStep(+step)} />
<Icon icon={minusIcon} onMouseDown={() => this.startStep(-step)} />
</div>
Expand Down

0 comments on commit 9983710

Please sign in to comment.