Skip to main content

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('divdid$="_inplacerte"]');

txtArea.html("testing 123");

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


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


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


Hey Shahad yes we figured it out! 

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

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


@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