gpt4 book ai didi

forms - ExtJS:针对模型的表单验证

转载 作者:行者123 更新时间:2023-12-04 02:10:41 26 4
gpt4 key购买 nike

我正在学习 ExtJS,我遇到了两个不同的概念,它们在逻辑上似乎与我有关。

  • 模型类可以在其字段上指定自定义验证方法。
  • 模型实例可以加载到表单中,也可以从表单中检索。

  • 我的问题是:
  • 是否可以让表单使用模型的验证设置来验证用户输入的内容并显示实时反馈?
  • 如果 1 的答案是否定的,那么还有其他方法可以在表单中设置实时验证吗?

  • 谢谢

    最佳答案

    1. Is it possible to have the form use the model's validation setup to validate what the user enters and show realtime feedback?



    没有用于模型实时验证的内置功能。但是,有比使用模型验证更好的方法。

    2. If the answer to 1 is No, then is there any other way to set up realtime validation in the form?



    就在这里。
    表单字段支持 vtype 配置(更多信息可以在 here 中找到)。默认情况下,每次字段的值更改时都会验证字段(如果您想关闭此行为,请将字段的 validateOnChange 配置设置为 false)。

    退房 docs ( Validation 部分和 Example usage 部分)了解更多信息。

    关于forms - ExtJS:针对模型的表单验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7300627/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com