To display values of Multi Line Text in Separate Lines

rishabh31
Mega Sage

Dear Team,

I have a Multi Row variable set Product Details in a catalog item under which there are 2 variables, one is Product Name Type-Single Line Text and the other Variable Product IDs of Multi Line Text type, here when a user click on Add button to insert the details and enters space-separated values in Multi Line Text type variable Product IDs, and click on the button Add, and then in form, it currently displays as as shown in attached screenshot. 
But I want this to be displayed in Separate lines in the form when added.
like as shown in the attached screenshot
To achieve this I wrote an onload catalog client script (shown below and also attached) in this MVRS variable set, which is

 

function onLoad() {
    //Type appropriate comment here, and begin script below
    var major = g_form.getValue('product_id_s');
	var value1 = major.split(' ');
    alert("item length:" + value1.length);
    var bs = [];
    var resp = '';
    for (var i = 0; i < value1.length; i++) {
        resp = value1[i].split('\n');
        bs.push(resp[0]);
    }
	g_form.setValue('product_id_s', bs.join('\n'));
}

 

But this is not working. Please help to achieve this. The use case is to differentiate each product ID into separate lines to give better understanding and clarity. I tried the HTML type variable but mvrs does not allow the HTML type variable.
 
Thanks in advance.
5 REPLIES 5

wul
Tera Contributor

Hi,Did you finished this issue? I have the same problem now, would you please elaborate on your solution?

thank you very much.