Solved

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

  • 21 March 2018
  • 7 replies
  • 439 views

Badge +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");

icon

Best answer by janasmuth 4 October 2018, 00:51

View original

7 replies

Badge +5

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);
}

Badge +4

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

Badge +3

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

Badge +4

Hey Shahad yes we figured it out! 

NWF$("#" + ClientIDJavaScriptVariable).siblings().contents().find('body').html(data);
Badge +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");
Badge +9

@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.

Reply