Meeting unique validation requirements for content types in the same list
Meeting unique validation requirements for content types in the same list.
We can create seperate forms for each content type using InfoPath. It’s pretty easy. However, you cannot customize New/Edit/View forms with InfoPath. You can, however, use SPD and ListView WebPart. That will be the topic for another post.
So, first I’ve set up my Tasks list to have an extra content type (ignore the summary task – I will). I have the Task content type, which is out-of-the-box. I also have a Simple Task content type, which has Task as the parent. I’ve added a new field, called Owner. That’s the only difference. See List Settings from within IE and then from within SPD.
(sorry for the poor image, WordPress is giving me a headache with it. SimpleTask has an Owner field, Task does not.)
Now go to your Tasks List and click Design Forms in InfoPath. Select the content type you wish to modify. I’ll demo a custom InfoPath form for my SimpleTask content type.
Here are my changes to the form (I’ve added a blue title and made the Owner field red to bring attention to it):
Using the InfoPath client Backstage area, found under File tab, the form is published to the list.
This message indicates all went well.
Now, in the web browser, selecting a new SimpleTask from the New Item menu will display the newly customized form.
Here is the customized Simple Task content type form.
A customized Task form can also be created.
Here is the customized Task content type form.
Now let’s make the Task more complicated in validation. Let’s create a rule that says the “Due Date” is required when a “Start Date” is provided.
After publishing the Task form and starting to fill out a new task item, the validation error is revealed.
So, in summary, you can have an InfoPath-customized form for each content type. This works well if you need to validate data differently for each content type. Using InfoPath, we can set our own data validation rules. Since each content type can have its own form, each content type can have its own validation rules.