Hello Friends
v Business Case:
Let’s say we have custom list and when any user enters a new item into list, every field must be editable, but when user edits any item, at that time some of fields should not be editable, they should come only for display purpose.
v Possible Solution:
We can develop custom web part and write code to make some fields read only but we can easily achieve above functionality by just customizing edit forms into SharePoint designer.
v Solution:
A very simple solution
1> Open SharePoint Designer 2007
2> Open your SharePoint site
3> Open Custom list
4> Select Editform.aspx and .right click on it same file
5> Click on “New from Existing Page” Option value, it will create one new custom ASPX page for us from existing one.
6> Delete one web part which is already there into page and add click on Insert SharePoint Controls -> Custom List Form.
7> Select Appropriate List, it’s content type and Type of Form to create as per below image.
8> Click Ok button. It will automatically add one new Data Form Web part with all list fields in edit mode.
9> Now you can change this form as per your needs and requirements. Like if you do not want some of fields then you can delete those fields from current page. In my requirement I have to make “EmployeeID” as read only field means user can see the field but they can’t change the field values..
10> Select EmployeeID Field from user interface. Click on “tag Properties”, there you can see “Control Mode” as Edit.
11> when you click on ControlMode option, you can see available values that are Invalid, Display, Edit and New. Select “Display” as option value for displays purpose.
12> Save form under your current site name -> Lists->List Name and give file name with .aspx extension.
13> Select List -> Right Click List Properties and Go to Supporting Files and In Edit Item Form Properties, Browse to Your newly created Form and click on apply and Save the site.
14> Go to your SharePoint site .Select list and click on edit item, here in edit page you can see the result.
In these ways from SharePoint designer, we can make some of the fields as read only and editable also, I think, SharePoint designer is very powerful tool; just we need to find in which way we can take advantage of designer functionality!!