Calculated Value control renders html differently in different modes


Userlevel 6
Badge +13

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.

18910iD92F231BE898B944.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).

18911i4536F6D73507D6DC.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.


10 replies

Userlevel 3
Badge +12

Hi,


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


 


 

Userlevel 6
Badge +13
Yes, I've tried that, I've also tried different types of html or making the text box to plain text and using
.
Userlevel 5
Badge +13

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.


 



 

Badge +12

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

Userlevel 6
Badge +13

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

Userlevel 6
Badge +13

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?



 

Badge +12

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

Userlevel 6
Badge +13

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.

Badge +12

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

Badge +1

If it can help , just put your Html code in a div , for exemple i want to display Juce,Pome,and Orange with br


In a calculate value I put this : "<div>Juce<br>Pome<br>Orange<br></div>"



I get this :



Tks U Maisa 


 




Reply