Consider the basic list form below. This is what I'd see if I were adding a new task to my SharePoint Task List. To illustrate my example I've added two extra fields to the Task List, a Yes/No field called Special Conditions Applied (with a default of No), and a text field called Special Conditions Description. Both are highlighted in red below;
My requirement for today is that the Special Conditions Description field is only shown on a new item form when the tick box for Special Conditions Applied is ticked. If there aren't any special conditions applied, why would my user want to fill that field in?
It turns out that I can meet my requirement and hide the field in less than a minute! The key to it is a certain magic button on the ribbon of the list. The purple button below 'Customize Form' will allow me to edit my New Item form in Infopath 2010, so give it a click!
Infopath opens and shows an edit view of my form as below. I want to change my Special Conditions Description field so I click it with the mouse and select it as below;
To make the form do what I want, I'm going to add a Rule. Click Manage Rules on the ribbon within Infopath, then select New -> Formatting [rule] ;
Add a meaningful name for your rule (as it may not be the only one you do once you get started with this sort of work!). Tick the 'Hide This Control' tickbox as circled in red.
We don't yet have a condition for when to hide the control, so click on the 'None' link under 'Condition' above, and a new dialog will open to allow you to specify the condition as below. I want the rule to run when the 'Special Conditions Applied' field is not ticked, so I select when this is equal to FALSE, and OK the dialog;
That was all I needed to do for the rule. Easy huh? Now we Publish our work, and we're ready to see the result. Click the Quick Publish button on the ribbon below;
We then get a notification of successful publishing;
Back in SharePoint, when creating a new item on the Task List now, I see my custom Infopath form. With the Special Conditions Applied field unticked, I see no Description field. You still see the label for the field OK, but with an extra rule you could have hidden that too - just keeping it simple! :)
With the Special Conditions Applied field ticked, our user sees the Description field and can fill it in;
The other great news about this is that although you needed Infopath 2010 on your machine to do the form change, all users of the form do not need Infopath simply to use your form. This is a webform that SharePoint is now serving, no extra software required.
This very quick introduction to Infopath 2010 Forms with SharePoint have hopefully persuaded you that your SharePoint forms can easily be made smarter than the default forms you get on lists. With a little experimentation you could quickly introduce form validation, and prefilling of field values.
No comments:
Post a Comment