I want on EditForm to execute javascript to compare the field "Start Date" with the current date. In case the current date >= start date to make a field read only.

How can i get the value of a field of current item and then compare it with current date?


  • Is it a custom form you are creating using SPD? – Amal Hashim Oct 27 '17 at 14:44

Something like:

var startDate = document.queryAllSelector("input[title='Start Date']")[0];
var startdateValue = new Date(startDate.value);
var today = new Date();
if(today >= startdateValue)
  startDate.readOnly = true;

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.