How to hide fields for new items using InfoPath
A client had a fairly simple request to hide some fields when a new SharePoint list item is created but have these fields shown once the item has been created and people edit the form. The short version is that you can use the inbuilt ID field to see if an item is new or not. If the ID field is blank then it is a new form.
Here are the steps required so that you can hide fields when an item is being created. Make sure not to hide any required fields or the form cannot be saved.
These steps require InfoPath 2010 client to be installed
1. Navigate to the list
a. I have created a very simple list where users will ask a question. The goal is only to allow users to fill out the title field when an item is created
2. From the ribbon select the Customize Form option
b. If this option is missing then following feature is probably not activated
3. A form will now have opened in InfoPath 2010
4. Each field can be hidden manually or all of the fields you want to hide can be added to a new section and then you just hide the section.
a. Select the Section control and add to the bottom of the form
b. Copy or cut the required rows or fields from the table into the section. It will look similar to the following screen shot
5. Now we need to add a rule to the section to hide it.
a. Select the Manage Rules option from the ribbon
c. Highlight the section (Click on it)
e. From the Rules menu on the left hand side select New and then Formatting.
i. Change the name to be Hide Section
ii. Click on the None under condition and change it to the following
iv. Now select the Hide this control option
v. The whole rule should look like
6. Using the publish button in the very top left of InfoPath publish you changes back to the server.
a. You should receive an OK message once this is complete
7. Now navigate to the list and test to see if it has worked
Here is the new form
This is what the form looks like when an existing item is edited
This is just a very basic example. The overall style of the form can be changed using the formatting option within InfoPath.
Rule can also be applied directly to some fields so they do not have to be moved into a section if you do not want to. The attachment control must be added to a section as rules cannot be applied against this control directly.
via Buzz Blog http://bit.ly/LK0nvp
Paul is a an expert SharePoint and Project Server developer and is responsible for designing and implementing custom solutions on client systems using the latest SharePoint and .NET technologies.
Paul has extensive experience with SharePoint systems across all sizes of implementation, ranging from small to large farms and has an excellent understanding of all the elements of SharePoint. This article has been cross posted from paulbuzzblog.wordpress.com (original article) |