Skip to main content
Nintex Community Menu Bar
Answer

Is it possible to set a value for Multi Line Textbox with rich text enabled?

  • March 21, 2018
  • 7 replies
  • 751 views

Forum|alt.badge.img+4

Hello there,

 

I would like to know if it is possible to set a value for a Multi Line Textbox with rich text enabled in a Classic Form via JavaScript? I would like to be able to update the value of the field with html content depending on another field.

 

I tried already many different things but nothing worked so far and I am able to set the value for text fields and normal multi line text fields.

 

I tried things like this but without any luck: 

var txtArea = NWF$('#'+ remun).closest('tr').find('div[id$="_inplacerte"]');

txtArea.html("testing 123");

Best answer by janasmuth

Hey Shahad yes we figured it out! 

NWF$("#" + ClientIDJavaScriptVariable).siblings().contents().find('body').html(data);

7 replies

Forum|alt.badge.img+5
  • March 22, 2018

I use this function to set mine. I add a form variable with a reference to this function. Use a unique class on the rich text field and pass that along with the text you'd like to the function.

function setMyRichTextField(FieldClass, RichText) {
    "use strict";
    NWF$("." + FieldClass).innerhtml(RichText);
}


Forum|alt.badge.img+4
  • Author
  • March 22, 2018

Hey Jeremiah thanks for your reply.

Here is what I did to reproduce your solution:

  • I inserted a Multi Line Textbox with enhanced rich text enabled
  • I inserted your function as Custom JavaScript under Form Settings
  • I called the function via Form variable like this: setMyRichTextField("MyField", "<p>Test</p>")

When I run it I get the error "Uncaught TypeError: NWF$(...).innerhtml is not a function" and if you search for that error they tell you that you should use" .innerhtml = RichText. This doesn't produce an error but is also not working.

Do you use a normal Rich Text field or a Multi Line Textbox in your solution? 

Thanks

Jan


Forum|alt.badge.img+3
  • October 2, 2018

I am struggling with this. did you find any solution?


Forum|alt.badge.img+4
  • Author
  • Answer
  • October 3, 2018

Hey Shahad yes we figured it out! 

NWF$("#" + ClientIDJavaScriptVariable).siblings().contents().find('body').html(data);

Forum|alt.badge.img+1

The accepted solution didn't work for me in Nintex 2016 4.2.1, but I was able to get it working with the code below.

 

var ntxCtrl = NWF$('#' + ClientIDJavacriptVariable);
NWF$('#' + ntxCtrl.attr("id") + "_inplacerte").html("Test Content Here");

Forum|alt.badge.img+9
  • January 9, 2020

@kyle_wright wrote:

The accepted solution didn't work for me in Nintex 2016 4.2.1, but I was able to get it working with the code below.

 

var ntxCtrl = NWF$('#' + ClientIDJavacriptVariable);
NWF$('#' + ntxCtrl.attr("id") + "_inplacerte").html("Test Content Here");

I can confirm this works.


Thanks Kyle,

Confirming your solution also work with SP on-premise 2019 and Nintex for SP.