I had a requirement of implementing a line break in an info message. I have tried many methods : \n, <br> <BR>… But nothing worked for me. But in the end of the day, I have used a cool trick to get aroud this issue, which I want to share with you today!
// First method: allow you to have just one message translated
var msg = "/ ! \\*Lorem ipsum dolor sit amet, consectetur adipiscing elit.*Cras venenatis tempus nisl, eu blandit arcu laoreet non.";
var splited = msg.split('*');
var l = splited.length;
for(var i=0; len>i; i++)
{
g_form.showFieldMsg("line_break_test", spli[i], "info");
}
// Or just use that, i you d'ont have much line to translate.
g_form.showFieldMsg("line_break_test", "/ ! \\", "info");
g_form.showFieldMsg("line_break_test", "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "info");
g_form.showFieldMsg("line_break_test", "Cras venenatis tempus nisl, eu blandit arcu laoreet non.", "info");

Recent Comments