Hi,
Earlier in MOSS 2007, it was not possible to validate the value of the field at the time of entering or updating the value in the list items. We could do that, but we had to rely on handlers or custom fields.
Yes, still for some requirement we have to go with these options, but at least for the basic and indeed useful now we have something called column validation in SharePoint 2010.
I have one Employee List ready in my SharePoint site and I have added three columns to it. It has Joining Date, Leaving Date and weight.
We will see two things here. First is the field level validation and the other is item level validation. You can treat this as a custom field validation and event handler validation.
Go to list setting and then click on the weight and now we can see one new section which says column validation. So go ahead and add below condition and type in the user message that you would like to see when condition becomes false.
Click on ok.
Now being on the list settings page, you can see one more new option which is validation settings. Click on it to open a page.
In validation settings, you can actually compare one field with the other field from the list and then show a message to the user. Here in our list for example, we have two date fields and of course joining date cannot be greater than Leaving date. Hence we need to validate these two date fields.
Hence we put this formula inside it.
Now go to the list and add new item and enter weight less than 50 and enter joining date greater than leaving date and see validation triggering.
Now this is a cool new feature of SP 2010, isn’t it?
But yes do remember that we can have only one list validation, which is unfortunate i think and column validations are evaluated first and then list validation.
SharePoint Kings,Technosavvy guys hunting SharePoint Challenges... SharePoint 2013, SharePoint 2010, MOSS 2007, Windows Workflow Foundation, Project Server and Other Related Technologies.
Subscribe to:
Post Comments (Atom)
Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!
If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com
2 comments:
Hi
I have created a custom column with validation as you specified Weight<50 but even i enter 60 it shows the error message.
Shafaqat Ali,
to compare value with operators, it has to be numeric.
this is simple validation provided by SharePoint. There is no special trick are used so it must work.
Post a Comment