编写约束以根据 Orbeon Form Builder 中另一个字段中输入的值验证字段
我想根据“电话类型”字段中所做的选择来验证电话号码字段的大小。手机号码的大小应为 10,家庭和工作号码的大小应为 11。我将如何在 Orbeon Form Builder 中编写约束表达式。我尝试在约束字段中使用 if ,但没有成功。
感谢您的帮助!
I want to validate the size of the phone number field based on the selection made in the Phone Type field. Cell numbers should be 10 in size, Home and work numbers should be 11 in size. How would I write the constraint expression in Orbeon Form Builder. I tried using if in the constraint field, but was unsuccessful.
Thank you for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您有两个控件:电话类型和电话号码。
电话类型
。稍后您将把用户选择的值称为$phone-type
。work
和mobile
。创建一个单行控件(文本字段),单击红色感叹号打开“编辑验证属性”对话框,然后在“约束”下写入:< /p>
string-length(.) = (if ($phone-type = 'work') then 11 else 10)
Let's say you have two controls: a phone type and a phone number.
phone-type
. You will will refer later to the value selected by users as$phone-type
.work
andmobile
.Create a single line control (text field), click on the red exclamation mark to open the Edit Validation Properties dialog, and there, under Constraint, write:
string-length(.) = (if ($phone-type = 'work') then 11 else 10)