1

I am using JSLink to override a TextArea column on SharePoint 2013, when I am trying to get the field value using ctx.CurrentItem[ctx.CurrentFieldSchema.Name] on display form, it warps the value with an div element "<div dir="">.

However, on New and Edit forms, ctx.CurrentItem[ctx.CurrentFieldSchema.Name] return the value correctly without the div element.

So can I get the value from field without "<div dir=""> ? Thanks

(function () {
rendering functions
var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.Templates.Fields = {
    'Tile': { 'View': renenderTileField, 'DisplayForm': renenderTileField }

}
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);

function renenderTileField(ctx) {
    LoadCssForFrom();
    var fieldVal = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
    var html = [];
    html.push('<div class="col">');
    var content = generateHtmlForField(pickerObject, titleFieldVal);
    html.push(content);
    html.push('</div>');
    return html.join('');

}
}();
2

JQuery helps you:

$(ctx.CurrentItem[ctx.CurrentFieldSchema.Name]).text()
  • 1
    Sorry for inconvenience. It was not some misunderstanding from my side. I roll backed my review. – Aakash Maurya Oct 7 '16 at 13:48

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.