()
| 82 | } |
| 83 | |
| 84 | rectify_input() { |
| 85 | let val = '' + this.element.find('input').val() as string; |
| 86 | let re; |
| 87 | if (this.spec['type'] == 'number') { |
| 88 | re = /^[+-]?\d*$/; |
| 89 | } else if (this.spec['type'] == 'float') { |
| 90 | re = /^[+-]?\d*\.?\d*$/; |
| 91 | } |
| 92 | if (re && !re.test(val)) { |
| 93 | this.element.find('input').val(this.previous_value); |
| 94 | } else { |
| 95 | this.previous_value = val; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | // 检查输入项的有效性,在表单提交时调用 |
| 100 | check_valid(): boolean { |
no outgoing calls
no test coverage detected