Javascript won't update read-only CRM fields without special syntax

If you have a CRM field marked as "read-only", custom Javascript that updates or changes that field will not work (the changes won't be saved) until you use special syntax:

Xrm.Page.getAttribute("new_yourfield").setSubmitMode("always");

Xrm.Page.getAttribute("new_yourfield").setValue(new Date());

The setSubmitMode("always") syntax tells CRM to update the field despite the field being read-only.