列出 Orbeon 表单中所有无效控件
我的表单中有 30 个字段。在表单的底部有一个按钮,如果单击它,它应该显示所有无效的字段。无效还包括未填写必填字段。
使用xforms:trigger
我可以创建一个按钮,使用DOMActivate
甚至我可以编写xforms:action
。但是我应该在 xforms:action 中写什么来列出所有无效字段。
I have 30 fields in my form. At the bottom of the form I have a button where if I click on it, it should display all the fields which are invalid. Invalid includes not filling the mandatory fields also.
Using xforms:trigger
I can create a button and using DOMActivate
even I can write xforms:action
. But what should I write inside the xforms:action
to list all invalid fields.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

您可以通过侦听
xforms-valid
和xforms-invalid
等事件来实现自己的错误摘要,跟踪哪些控件有效和无效。但这不是一项简单的任务,特别是如果您想处理重复,甚至嵌套重复。幸运的是,这项工作已经为您完成,并且代码已放入可重用组件中:
。如果您使用 Form Runner,则默认情况下会为您设置错误摘要。否则,请参阅此文档,了解如何使用错误摘要组件。
You can implement your own error summary by listening to events like
xforms-valid
andxforms-invalid
, keeping track of which controls are valid and invalid. But this is not a trivial task, especially if you want to handle repeats, and even nested repeats. Fortunately, this work has been done already for you, and the code has been put in a reusable component:<fr:error-summary>
.If you are using Form Runner, the error summary is setup for you by default. Otherwise, see this documentation on how to use the error summary component.