How to set value of hidden column using CSR?
Following is the code to set value of a field
(function () {
var ctx = {};
ctx.Templates = {};
ctx.Templates.Fields = {
'Title': {
'NewForm': setTitle
}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctx);
})();
function setTitle(ctx) {
var temp = 'Title 1';
ctx.CurrentFieldValue = temp ; //set field value
return SPFieldText_Edit(ctx);
}
ctx
fields that are rendered (available in the view/form).ctx
. Instead what you can do is make column visible and then hide it using CSR. By this way your column will be available in the form and you will be able to set its value.