I just gave this a try, but no luck, it's still not saving the change. Here's what I tried:
var stri = (NWF$('.richText1').html());
NWF$('.richText1').html(stri.replace("[Role]", usrRole));
NWF.FormFiller.Functions.ProcessOnChange($NWF('.richText1'));
this didn't work, so next I tried this:
var stri = (NWF$('.richText1').html());
NWF.FormFiller.Functions.ProcessOnChange(NWF$('.richText1').html(stri.replace("[Role]", usrRole)));
when that didn't work, I tried this:
var stri = (NWF$('.richText1').html());
NWF$('.richText1').html(stri.replace("[Role]", usrRole));
NWF$('.richText1').trigger("focus out");
None of these are working. When the form gets submitted, the saved form's rich text box shows [Role] again.
@PeteCam instead of building text in rich text box, why can't you use the calculated control and then used that named control to populate your text box column?
It was a solution built 4 years ago, and we just discovered that the text in the rich text control wasn't being saved. I've since discovered that Nintex doesn't save the full form on submit. It only saves the fields linked to SharePoint fields, and anything else in the form is based on the published template. Update the template, and all historical records get the updated template too.
Ultimately, I solved the issue by having the JavaScript edit the rich text box in view mode by pulling from the Role field saved to the list and inserting into the html during load. So even though the rich text box isn't being saved as originally envisioned, whenever it's viewed it at least displays the correct info.