转:InfoPath 中,如何验证 Contact Selector 控件是否输入了有效值,或如何强制输入? Validate the Contact Selector in InfoPath – Make the Contact Selector Man
来源:互联网 发布:java throwable 编辑:程序博客网 时间:2024/05/18 06:27
Validate the Contact Selector in InfoPath – Make the Contact Selector Mandatory (version 2)
Here is a very quick and simple method of making your contact selector in your InfoPath form mandatory.
There are plenty of blogs out there that describe how to set up the contact selector in your InfoPath form so I won't bother documenting that here. If you need help, check out this blog.
After you have added your contact selector to the form, it will most likely look something like this:
Your data source will look similar to this
Note: Check to make sure your contact selector is working correctly before continuing with this blog.
- Firstly, add a new field to your data source called 'EmployeeName'. This will be the field that performs the validation check.
To add a new field, click on the "myFields" group in your datasource
Then click on 'Add new Field or Group'
Enter a name for your field and then click on Ok when you are done
After you have finished adding the field, your data source should look similar to this:
- Next we are going to set the 'EmployeeName' field to equal the display name entered in the contact selector.
Double click on the EmployeeName field to open the properties
Set the default value of the field to 'DisplayName'
- Now that the 'EmployeeName' equals the DisplayName all we need to do is set a validation rule on the EmployeeName so that it can never be blank.
Click on the 'Validation' tab in the EmployeeName field properties
Click on Add. Then set your validation rule as shown below.
Click Ok and Ok again to save the changes
I always put any validation rules for the contact selector on the 'EmployeeName' field rather than on the Contact Selector itself. My reasoning behind this relates to the validation error message that the user sees (below). Notice that it includes the name of the field that holds the error. 'Employee Name' makes it easy for the user to identify the field with the error. If you place the validation condition on one of the Contact Selector fields such as 'DisplayName' it is not very intuitive.
- Another thing that you can do to notify your users of the validation error is to include an error warning next to the contact selector on the form canvas.
On your form canvas, insert a section and in the section enter "Cannot be blank"limiting the number of names in the contact selector useful too.
You might like to highlight the text in red and make it italics so it stands out.
- Double click on the section you added to open the group properties
Click on the Display tab and then click 'Conditional Formatting'
Click on 'Add'
Set the condition "EmployeeName is not blank"
Tick the 'hide this control' checkbox
The condition should look like this:
Click on Ok 3 times to save the changes
- Publish your form.
Open a new form and you should see the error warning next to the contact selector name. If you enter a name into the contact selector, then the error message should disappear.
If you found this post useful, you may also find my post on
- 转:InfoPath 中,如何验证 Contact Selector 控件是否输入了有效值,或如何强制输入? Validate the Contact Selector in InfoPath – Make the Contact Selector Man
- 转:InfoPath 中,如何限制 Contact Selector 控件中输入的用户数量? Validate the Contact Selector in InfoPath – Limit the number of names a user can
- Contact Selector in InfoPath 2007 and 2010
- Using the Contact Selector Control
- Contact Selector Control
- contact
- Contact
- Contact
- contact
- Contact
- Contact
- contact
- Selector in the Dojo
- swift 中如何使用selector
- Selector uniquing in the dyld shared cache
- 如何在Ubuntu手机中实现Contact importer
- android如何替换contact的来电铃声
- USACO 3.1 Contact (contact)
- 创新工场
- 软件人社区 www.isoftman.com
- 网络媒体足球精英赛--凤凰网
- Jquery入门学习文档(手册)
- java中包命名的思考
- 转:InfoPath 中,如何验证 Contact Selector 控件是否输入了有效值,或如何强制输入? Validate the Contact Selector in InfoPath – Make the Contact Selector Man
- sql 2005 分页,排名函数
- 转:InfoPath 中,如何限制 Contact Selector 控件中输入的用户数量? Validate the Contact Selector in InfoPath – Limit the number of names a user can
- *rsi++ = Noisy(); 为什么调用copy构造函数,而不是=的重载函数?
- AppScan
- 好久没来了,前段时间病,和大家问个好
- 古老的杯子
- jquery全选和反选checkbox
- 安装SQL Server 2005发现了一个错误“如何在SQL Server 2005中为安装程序增加计数器注册表项值”