greenawayr
Automation Master
Automation Master

Calculated Value control renders html differently in different modes

Hi,

I'm facing an issue with Calculated values.

I have a control where the formula is set to a Multi-line textbox (RTF) named on my form.

There's history here, but basically the textbox will be hidden when the form is LIVE but for now I'm showing it here for demonstration purposes.

When I View the form, everything in the calculated value control (on the left) renders perfectly, as expected with line breaks etc.

greenawayr_0-1626986766599.png

However, when putting the form into edit mode, the calculated value loses all the line breaks, seemingly ignoring the HTML <br> in the multi line text box (on the right).

greenawayr_1-1626986842905.png

Is this expected behaviour do we know, if so any way around it? I've already spent many hours on this form and this current solution is a workaround of another issue that I found that Nintex won't support us on because it involves javascript. I thought I'd try the community before going for support (and counselling).

 

Thanks in advance anyone who can help.

0 Kudos
Reply
9 Replies
kchaluvadi
Workflow Veteran

Re: Calculated Value control renders html differently in different modes

Hi,

Have you tried setting the calculated control properties - "recalculate in edit mode" to "no" ?

 

 

0 Kudos
Reply
greenawayr
Automation Master
Automation Master

Re: Calculated Value control renders html differently in different modes

Yes, I've tried that, I've also tried different types of html or making the text box to plain text and using \n.
0 Kudos
Reply
Jake
Nintex Employee
Nintex Employee

Re: Calculated Value control renders html differently in different modes

Hi there.

 

Since the text value you are referencing is hidden on the form design, I assume then it will be stored in a list column, If that is the case you should be able to use a label control to display the html value of the multiline text without using a calculated control, Calculated controls are better for data that is manipulated in form context. 

 

If this doesn't fit you use case please let me know.

 

see below a screenshot of a version using the label instead of calculated value.

 

Jake_0-1627043841104.png

 

Reply
kunalpatel
Automation Master
Automation Master

Re: Calculated Value control renders html differently in different modes

@greenawayr correct me if I'm wrong.....you're trying to display the value of your MLT on the form but don't want users to make any changes, correct?

 

If that's the case, can you add your MLT control on the form and then go into its settings. Under Advanced, go to Control Mode and change it to Display Mode.

Reply
greenawayr
Automation Master
Automation Master

Re: Calculated Value control renders html differently in different modes

You are absolutely right in this, however I need to explain a bit more about the solution, to explain why I cannot use this approach.

 

Basically the MLT (body) contains some text, there is another MLT (update) that users fill in periodically and then at some point they will "commit" the "update" to the body. Originally this was done via workflow, when they saved the form having checked a box, however this was deemed too slow, so I have implemented javascript. When they click "commit" the "update" is prepended to the "body" text that already exists. However, when putting the control into Display mode, I could not get the text from the "body" MLT to store in a variable for my javascript, in a way that kept the lines breaks, there was some sort of inconsistent behaviour here (I can't remember what at the moment). I also tried to use javascript to disable the control (as disabling the control using rules or config, i believe meant the MLT would not be scrollable, so users were unable to see all the text), however, this worked in one Site Collection (Content Type Hub), on Edge but not on another (subscriber site). It did however work in IE. Again inconsistent behaviour. Nintex wouldn't help me resolve that issue though due to the use of javascript.

 

As you can see, I've tried several different paths before arriving at this approach, which is still flawed, so I'll just keep going.

 

Happy to take any suggestions to make this work.

Thanks

0 Kudos
Reply
greenawayr
Automation Master
Automation Master

Re: Calculated Value control renders html differently in different modes

Thanks for the suggestion, however I cannot see any way of referencing the list column in a label. Is this because the form is being created against a Content Type (in a content type hub) rather than in a list?

greenawayr_0-1627243630127.png

 

0 Kudos
Reply
kunalpatel
Automation Master
Automation Master

Re: Calculated Value control renders html differently in different modes

@greenawayr label won't work...you need to use MLT control.

0 Kudos
Reply
greenawayr
Automation Master
Automation Master

Re: Calculated Value control renders html differently in different modes

Hi,

As mentioned above, the MLT can't be used as the field should be read only, and the javascript doesn't seem to be able to hook into control properly in read only mode, and when disabled, the control is not scrollable.

So my approach of having the MLT hidden so it can be written to successfully, and then having the Calculated Value control show the MLT contents would appear to be the way forward, if the Calculated value rendered consistently in the same way the MLT does.

0 Kudos
Reply
kunalpatel
Automation Master
Automation Master

Re: Calculated Value control renders html differently in different modes

@greenawayr Control mode --> Display will force the control to be in the display mode and if you also select yes for resize at runtime then your problem will be solved. No one will able to edit the data from the form.

0 Kudos
Reply