如果现有项目在同一时间范围内,如何限制向 SharePoint 2010 列表添加新项目 [英] How to Restrict adding a new item to SharePoint 2010 list if the existing item falls in the same time range

查看:33
本文介绍了如果现有项目在同一时间范围内,如何限制向 SharePoint 2010 列表添加新项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 4 列的列表,即 Region Name(下拉选项)、Start Time(日期和时间)、End Time(日期和时间)和 Comments(多行文本).

I have a list with 4 columns namely Region Name (dropdown choices), Start Time (Date & Time), End Time (Date & Time) and Comments (multiple line text).

它允许用户预订特定时间范围内的区域,即使用开始时间和结束时间.

It allows users to book a region for a particular time frame i.e. using start time and end time.

我想进行验证,如果用户 A 在一段时间内选择了 Region1,其他用户说如果开始和结束时间一致,B 应该无法选择相同的区域.

I want to put a validation such that if user A has selected Region1 for some time period the other user say B should not be able to select the same region if start and end time coincides.

推荐答案

对于 InfoPath,我可以想到这个解决方法.

For InfoPath, I can think of this workaround.

例如,用户已经选择了 Region 1 7:00-8:00AM,用户 B 应该不能选择/提交这个时间表.您可以做的是将值(区域和开始/结束时间)传递给列表数据连接.然后它将查询列表.如果找到匹配项,则设置一个动作,将值(如 ID)传递给隐藏的文本框.这意味着有人已经提交了这个时间表.然后显示错误/文本框消息并禁用提交按钮.如果查询返回 null,则显示 Ok 消息.

For example, a user already selected Region 1 7:00-8:00AM, user B should cannot choose/submit this schedule. What you can do is pass the values (Region and Start/End time) to the list data connection. Then it will query the list. If it found a match, set an action that will pass a value (like ID) to a hidden textbox. This means that someone already submitted this schedule. Then show an error/textbox message and disable the submit button. If the query returns null, then show a Ok message.

您可以使用检查是否可用"按钮来触发此查询或将其放在提交按钮上.我建议使用复选按钮,以便用户可以在提交前修改时间表.

You can use a button "check if available" to trigger this query or put this on submit button. I suggest the check button so the user can modify the schedule before submitting.

这篇关于如果现有项目在同一时间范围内,如何限制向 SharePoint 2010 列表添加新项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆