要求选择值的验证语法是什么?
我一直在 Orbeon Forms 中使用以下语法的可见验证属性:
$control-132 = 'yes'
基本上,yes
表示已选择控件的标有“yes”的单选按钮。如果用户选择“是”单选按钮,则带有验证的隐藏控件将变得可见。谁能告诉我如何编写一个表达式来简单地验证已在字段中输入的数据?
IE-我试图写 --- $control-132 = 'yes'
--- 被写 --- $control-132 = '*'
---
没用。 如果任何数据已输入控件,我只需要进行验证。
I have been using the visible validation attribute in Orbeon Forms with this syntax:
$control-132 = 'yes'
Basically, the yes
means that the control's radio button labeled 'yes' has been selected. If a user selects the 'yes' radio button, a hidden control with the validation becomes visible. Can anyone tell me how to write an expression that simply validates data has been entered in a field?
IE- I tried to write --- $control-132 = 'yes'
--- be written --- $control-132 = '*'
---
Didn't work.
I just need the validation to occur if ANY data had been entered into the control.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为,如果用户忘记选择您提供的选项之一(在本例中是通过单选按钮),您希望使该字段无效。如果确实如此,您只需将该字段标记为必填即可。 (如果使用 Form Builder,您有一个“必需”单选按钮,可以将其设置为“是”。如果您正在编写 XForms,请使用.
$my-field != ''
。I gather that you want to make the field invalid if users forget to select one of the options you provided, in this case through radio buttons. If this is indeed the case, you can just mark the field as required. (If using Form Builder, you have a "Required" radio button you can set to "Yes". If you're writing XForms, using
<xforms:bind required="true()"/>
.Alternatively, if you really want to do this with an XPath expression, the expression would be:
$my-field != ''
.