The same with my previous post on Client-Side Rendering in View Form, this post will not discuss as well the WHATs and WHYs of Client-Side Rendering but it will provide a demonstration of its HOWs in SharePoint Online and On-Premise.
What to be expected after the steps below? Based on user permission, the column New Form Column will be accessible. NOTE: This post will not demonstrate a column-level permission solution but it will guide us on how to manipulate a column in a New Form.
- I started by creating a SharePoint solution in Visual Studio. Since it is designed for SharePoint Online and On-Premise, I have chosen sandboxed solution as its trust level.
- In my solution, I have added a List module to create a document library that will hold the .js file that we will be creating in a while. I have named the document library as View Form Assets.
- Then, I have added a module with NewForm.js file. This file will be discussed in the succeeding steps. At this point enough to have a blank .js file. Notice that the URL of the .js file is pointed to the document library we have just created.
- I have added as well a Site Column or Field Element in my solution. I have named the field as New Form Column. This is the text column that we will manipulate later. Please note of the JSLink property. It is pointed to the NewForm.js file that will be stored in the New Form Assets document library.
- Now is the NewForm.js file. It simple as having few functions.
NOTE: As I have mentioned above, this post will not demonstrate a column-level permission solution but it would fundamentally guide us on how to manipulate a column in a New Form. This is the reason that I have not included a screen capture of the PortalIntegrators.HasPermission function.
After building my solution, I have just deployed the .WSP file in the solution gallery and activated the feature.
And finally, I have added the New Form Column in my list. With that I could now enjoy using a customized column in my New Form.
Hope this would help.