MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / rectify_input

Method rectify_input

webiojs/src/models/input/input.ts:84–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 {

Callers 2

create_elementMethod · 0.95
get_valueMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected