aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/hex-as-decimal-input.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/hex-as-decimal-input.js')
-rw-r--r--ui/app/components/hex-as-decimal-input.js29
1 files changed, 24 insertions, 5 deletions
diff --git a/ui/app/components/hex-as-decimal-input.js b/ui/app/components/hex-as-decimal-input.js
index e39805787..96a11b84f 100644
--- a/ui/app/components/hex-as-decimal-input.js
+++ b/ui/app/components/hex-as-decimal-input.js
@@ -56,12 +56,11 @@ HexAsDecimalInput.prototype.render = function () {
}, style),
value: parseInt(decimalValue),
+ onBlur: (event) => {
+ this.updateValidity(event)
+ },
onChange: (event) => {
- const target = event.target
- const valid = target.checkValidity()
- if (valid) {
- this.setState({ invalid: null })
- }
+ this.updateValidity(event)
const hexString = (event.target.value === '') ? '' : hexify(event.target.value)
onChange(hexString)
},
@@ -103,6 +102,26 @@ HexAsDecimalInput.prototype.render = function () {
)
}
+HexAsDecimalInput.prototype.setValid = function (message) {
+ this.setState({ invalid: null })
+}
+
+HexAsDecimalInput.prototype.updateValidity = function (event) {
+ const target = event.target
+ const value = this.props.value
+ const newValue = target.value
+
+ if (value === newValue) {
+ return
+ }
+
+ const valid = target.checkValidity()
+ console.log('change triggered checking validity and found ' + valid)
+ if (valid) {
+ this.setState({ invalid: null })
+ }
+}
+
HexAsDecimalInput.prototype.constructWarning = function () {
const { name, min, max } = this.props
let message = name ? name + ' ' : ''