Skip to main content

I am auto-populating fields in a Nintex Form using data from a SharePoint 2016 list. I can populate all the fields correctly except Rich text, and Enhanced rich text fields.

I am using the following code:

var varAPP_MEMO = NWF$('#' + APP_MEMO_1_JAVA).val();
var varAPP_MEMO2 = NWF$('#' + APP_MEMO_1A_JAVA).val();
var varCOMBINE = varAPP_MEMO1 + "
" + varAPP_MEMO2
NWF$('#' + WATER_APP_MEMO_COMBINE_JAVA).val(varCOMBINE);

I am able to fill the control when "WATER_APP_MEMO_COMBINE_JAVA" is a plain text Multi-Line control with both values on a separate line.

If the control is a Rich text Multi-Line, it inputs the value all together without the hard return (/n).

If the control is a Enhanced Rich text Multi-Line, it doesn't input the values at all.

 

Hi Ray Donovan

This is how to update an enhanced rich text multiline field:

var varAPP_MEMO1 = NWF$('#' + APP_MEMO_1_JAVA).val();
var varAPP_MEMO2 = NWF$('#' + APP_MEMO_1A_JAVA).val();
var varCOMBINE = varAPP_MEMO1 + '<br />' + varAPP_MEMO2;

var txtArea = NWF$('#'+ WATER_APP_MEMO_COMBINE_JAVA).closest('tr').find('divdid$="_inplacerte"]');

txtArea.html(varCOMBINE);

Hope this helps


Thanks Paul, I tried the code and it inputs into a Enhanced Multi-line text control but there are two other Enhanced Multi-line text controls that are connected to other columns, but they are getting the value of the variable txtArea when the form loads. The script causes all Enhanced Multi-text controls to have the same value regardless of which column they are connected to.

Ray


Another peculiar thing is when you initially use the code with <br />, it correctly inserts the hard return into the control. If you edit the Custom JavaScript after saving, the line turns into this:

var varCOMBINE = varAPP_MEMO1 + '
' + varAPP_MEMO2;

It inputs the hard return into the code so the first line doesn't contain a ; and the script doesn't work properly. If you delete the extra line and re-insert the <br />, the script runs correctly until you edit it again and save. This appears to be a bug in Nintex.


Hi Ray Donovan

I noticed you need to edit that line of code every time.
or
doesn't do anything for me. this is the only way i could get it to work.

To get the correct field to update, if you load up the newform.aspx, hit f12, use the dom explorer and highlight the field you want to update, you will see something like:

the id of the highlighted section is the important bit. the code currently is looking for any div with an id containing _inplacerte. if you double click the id bit in developer tools and copy and paste that into your javascript so you will have a line of code like:

var txtArea = NWF$('#'+ WATER_APP_MEMO_COMBINE_JAVA).closest('tr').find('diviid$="ctl00_ctl40_g_ee2920fd_c662_4609_85bd_711d4c1e1ff0_ctl00_ListForm2_formFiller_FormView_ctl30_9f56eaa0_ef67_438c_baff_8726351bb970_inplacerte"]');

As long as you have enough of that value to make it unique, your correct field should be the only one that updates.

Let me know how you get on


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

Reply