I am working on a custom list inside a classic team site. and inside the edit form i added this jQuery code to disable 2 fields (so those fields will only be set when creating the item):-

$("input[id^='ESTCompletion']").attr('disabled', 'disabled');
$("input[id^='Completion']").attr('disabled', 'disabled');

enter image description here

but since the users can disable javascript and bypass the validation and modify these fields..

so can i write a validation rule inside the list validation to make sure that those 2 date fields will not be modified when editing the item?

In the on-premises farm, i use to write an item-updating event receiver to do such checks, but in the online world implementing those will require lot of efforts and hosting cost.. so i was thinking if i can do these checks inside the list validation?


If we use list validate settings to prevent modifying fields, it will affect both create new item and edit item.

If you use classic experience in SharePoint Online, as an alternative, you can use SharePoint Designer, create a new custom edit form and set it as default, then find the relevant field and change the "ControlMode" property from "Edit" to "Display":

enter image description here

The result displays as below:

enter image description here

  • but the issue i am facing recently is that using custom edit form, will not work on sharepoint mobile app, so even if i use custom edit form, users who uses the SP mobile app will be able to edit the read-only fields. while the setting inside the list validation should work on all the means/devices.. is that why i asked my question... seems i will need to implement an itemupdating remote event receiver..
    – John John
    Aug 23 '19 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.