How to display field as read-only or hide it in a form?
Posted by Arnel Tolentino - Jul 8 ’13 at 11:35
Hi Everyone,
How can I display these fields as read-only in a form and how can I hide them as well?
1. Single line of text.
2. Date and Time.
3. Choices.
Thank You,
Arnel
-
DmitryAdminMember for: 10 years 9 months 19 days
Hello Arnel,
You have to set ReadOnly property of the fields to True:
-
DmitryAdminMember for: 10 years 9 months 19 days
[#1]: If you wish to hide them, just do not put them into the form with Forms Designer. If you wish to hide them dynamically based on other field values, please, visit this thread: http://forum.spform.com/forms-designer/set-a-field-to-invisible-through-script-53/
-
Arnel TolentinoMemberMember for: 9 years 8 months 21 days
Hi,
Yes, I already try that but its only showing blank field. I have a default value for this Date and Time field (Today's date) now its totally gone. I just wanted to make this read only so users wont be able to change it.
Thank You,
Arnel
-
Arnel TolentinoMemberMember for: 9 years 8 months 21 days
[#2]: Just to confirm regarding this code below. Which part should I replace for the info of my field?
$('.fd_field[fd_name="V3Comments"]').hide();
Thank You,
Arnel
-
DmitryAdminMember for: 10 years 9 months 19 days
[#3]: Hello Arnel,
I created a new Custom list, added Date and Time field and set default value to Today's Date in its properties:
Then I put this field into the form and set ReadOnly property to 'True':
Saved these changes for all types of form:
Here is my New form:
-
DmitryAdminMember for: 10 years 9 months 19 days
[#4]: You have to replace V3Comments with an internal name of your column.
You can read the following article to see how to get internal names of SharePoint columns: http://www.idubbs.com/blog/2012/finding-internal-names-for-sharepoint-list-columns/
-
Arnel TolentinoMemberMember for: 9 years 8 months 21 days
[#5]: Yes, it seems to be working now. Maybe it just need some time to propagate thats why it doesnt work before.
Thanks,
Arnel
-
Arnel TolentinoMemberMember for: 9 years 8 months 21 days
[#6]: Thanks! It works.