Requirement: As an admin user, I want read only access on a field for a specific role.
Solution: First of all having read or write access on a particular field is not possible in Sitecore. So now the question is, what can be done in this situation? And the answers is, by restricting the field itself for required user or role. To achieve this, you have to break the inheritance of this field for the required role.
- Go to Role Manager and Create a new Role
- Select the newly created role and add the required role in members list.
- Go to Security Editor and select the newly created role and then navigate to field (to be restricted)
That’s it, we are done with restricting a field access for a particular role. Now, the field will not be visible for the selected role users on template item.
WFFM provides an inbuilt way to hide one or more fields form rendered for an end user. Of course, I am not gonna use any CSS or JS to achieve this, instead, I’ll show you to do this by using an inbuilt feature of WFFM.
- Go to Form Designer and select the field you want to hide and scroll the left bar and click on Edit button shown under the Rules section.
2. Clicking on Edit button will open a popup with some predefined conditions and actions. Search for the “Database” and select the “where the current database name compares to value”. Click on “compare to select the compare rule and from there select “Is Equal To” and then click on “Value” and enter your web database connection string name like “web”.
3. Now select the “hide element” actions tab and click ok.
that’s it. Save the changes and publish the form. Now, the selected filed will not be available in the browser.