dojo – 禁用提交按钮直到验证

有没有办法使用dojo / dijit来禁用提交按钮,直到表单中的所有字段都有效.有点像道场> 最佳答案 您是否使用dijit.form.Form小部件作为表单?如果您是,我建议您连接到Form的onValidStateChange事件.此事件的
docs特别声明了您的用例:

onValidStateChange
Defined by dijit.form._FormMixin
Stub function to connect to if you want to do something (like disable/enable a submit button) when the valid state changes on the form as a whole. Deprecated. Will be removed in 2.0. Use watch("state", ...) instead.

查看给定窗口小部件可用事件的最佳方法是在“事件摘要”标题下查看您感兴趣的窗口小部件的API Documentation. dojocampus参考文档通常省略了对小部件的一些更加模糊的功能的引用的示例.

点赞