pywebio / PyWebIO

Write interactive web app in script way.
https://pywebio.readthedocs.io
MIT License
4.49k stars 384 forks source link

input_group action cancelable 表现错误 #614

Closed kkkbird closed 10 months ago

kkkbird commented 10 months ago

BUG描述 使用input_group的例程,添加cancelable=True

def check_form(data):
    print("call validate check form")

    if len(data['name']) > 6:
        return ('name', 'Name to long!')
    if data['age'] <= 0:
        return ('age', 'Age cannot be negative!')

data = input_group("Basic info", [
    input('Input your name', name='name'),
    input('Repeat your age', name='age', type=NUMBER)
], validate=check_form, cancelable=True)

if data is None:
    put_text("cancelled")
else:
    put_text(data['name'], data['age'])

故意输入错误的name或者age字段,submit使validate返回错误。再点击cancel,此时validate不会被调用,data获得的是上一次的错误的值

环境信息

wang0618 commented 10 months ago

多谢反馈,尽快会修复这个bug

wang0618 commented 10 months ago

新版本 v1.8.3 中已经修复这个bug