Below is my simple code to render the "Activitydescription" field in the newform.aspx. This is working.
(function () {
var ActivitiesListContext = {};
ActivitiesListContext.Templates = {};
ActivitiesListContext.Templates.Fields = {
"ActivityDescription": {
"NewForm": RenderField // this function is present in the code, but not shown here
}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ActivitiesListContext);
})();
Going further, my requirement is to load current user's info before the JSLink renders the list form. I'm not able to use the '_spPageContextInfo.webAbsoluteUrl' to make a REST call, since the '_spPageContextInfo' is not loaded at the stage JSlink is rendered.
I have to render the form conditionally based on some user properties. How do I achieve that?