input: move validation to setValue to affect incoming values too
This commit is contained in:
parent
2877877919
commit
6d9653a493
1 changed files with 5 additions and 5 deletions
|
|
@ -114,11 +114,6 @@ class Input extends Canvas {
|
|||
|
||||
inputChange() {
|
||||
|
||||
if (this.validation && !this.input.value.match(this.validation)) {
|
||||
this.input.value = this.value
|
||||
return
|
||||
}
|
||||
|
||||
this.setValue(this.input.value, {sync:true, send:true})
|
||||
|
||||
}
|
||||
|
|
@ -144,6 +139,11 @@ class Input extends Canvas {
|
|||
|
||||
setValue(v, options={} ) {
|
||||
|
||||
if (this.validation && !String(v).match(this.validation)) {
|
||||
this.input.value = this.value
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
this.value = JSON.parse(v)
|
||||
} catch (err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue