0
I have a situation where I want to display the values from a multi-relational field on a form using a text control instead of displaying the actual field itself.

This issue is that the text control just displays a long string with each value from the field just separated by a comma. Does anyone have any thoughts on how I can modify the display to show the individual values from the field on their own line. (ie, by replacing the comma with a line-break). I do seem to remember a very old post on how to do this on a listing report, but can't find it anymore.

Unfortunately, I just can't use the multi-relational field itself as I have a RelationalGridWidget on the form that uses this multi-relational field and can't have both on the form.

Any suggestions will be appreciated.

Accepted Answer

Wednesday, June 14 2017, 12:56 PM - #Permalink
0
Thought about it more.

So you don't have to have the multi rel on the form at all do this.

Set your text control to the value of the multi rel field on the refresh tab for the control by using the {MyMulti} syntax on form load.

Then create a form action that runs when the form is loaded and runs the following javascript.
That seems to work fine.

var x= GetFieldValue("MyText")
var res = x.replace(/,/g, "<br>");
SetFieldValue("MyText" , res);
  • Paul Thompson
    one week ago
    The multi-rel can go on a tab that gets hidden. We do that a lot.
  • David Sheaffe
    one week ago
    Thanks Brian. That works perfectly.
The reply is currently minimized Show
Responses (1)
  • Accepted Answer

    Wednesday, June 14 2017, 12:43 PM - #Permalink
    0
    David,

    See if this code helps at all. This was done by initially having the multi rel field on the form just so I could populate the variable initially but the point is more on how to get the text control to show multi lines.
    var x= GetFieldValue("MyMulti")
    var res = x.replace(/,/g, "<br>");
    SetFieldValue("MyText" , res);
    The reply is currently minimized Show
Your Reply

Recent Tweets