我有一个名为Current_Address__c的数据类型为textarea的自定义字段。文本区域换行符
我需要用下面的格式填充这个字段。即在街道之后换行符,并在zip之后换行。
街道 市州邮编 国家
市州邮编国家等的值被从接触对象获取的。我不想将此用作公式字段。所以我需要将它填充到我的控制器中,并将其显示在我的VF页面上。
我尝试使用下面的代码
this.customobj.Current_Address__c = currentStreet + '\\n ' + currentCity + ' ' + currentState + ' ' + currentZIP + '\\n ' + currentCountry ;
添加一个新行字符我也用\ n代替\ n。
它仍然显示领域的一条线,而不是三线
编辑
我用下面的代码得到了这个工作。我会接受mathews的答案,因为它可以和outputfield一起工作。
currentAddress = currentStreet;
currentAddress += '\r\n';
currentAddress += currentCity + + ' ' + currentState + ' ' + currentZIP ;
currentAddress += '\r\n';
currentAddress += currentCountry;
仅当您使用+ =时才有效。 不知道为什么会这样
林有同样的问题。我试过\ r \ n,\ n,\\ n甚至
,他们都没有工作! – raym0nd 2012-04-10 14:21:31
你使用什么类型的标签来显示数据? ''为我工作。 –
2012-04-10 14:25:21