How can I insert dynamic text into a rich text box and have it save when form is submitted?

  • 18 November 2021
  • 4 replies
  • 369 views

I have a rich text box with the following text:
"I have been a [Role] during all or some part of [Year]. I hereby affirm that I have reviewed the Code of Business Conduct and all applicable blah blah blah...."

when the form opens, some javascript code replaces the [Role] and [Year] values with the individual's role and the previous year. However, after submitting the form, the [Role] value is displaying as [Role] again. How can I replace this value and have it stay when user submits?

 


4 replies

Badge +9

see https://community.nintex.com/t5/Nintex-for-SharePoint-Forum/Not-able-to-set-the-date-time-field/m-p/45798 

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.




 


 

 

Badge +12

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

Reply