Plugins.dialogs Strips Line Ends

When I pass a string with multiple line end characters in it, that is “\n” characters, when the text is displayed all the lines are shown without line breaks.

Is there any way to get for example plugins.dialogs.showInfoDialog( ‘Information’, multiLineString ) to display the text without stripping out the line end characters?

thanks,

Terry

In NG / TiNG you can use
and other tags to format your Dialog.

function dialogTest() {
	plugins.dialogs.showInfoDialog('titel','message
spanning
several
lines.');
	// alternative
	var message = 'message with\nbreaks.';
	plugins.dialogs.showInfoDialog('titel',utils.stringReplace(message,'\n','
\n'));
}

Thanks Robert!

This has saved me a great deal of work. A couple of questions still remain:

  • why are the \n characters being kept. Why not "
    " rather than "
    \n"?

  • can any other HTML elements be used here too?

again my thanks and gratitude!

Terry

I keep the newline around due to force of habit and backwards compatibility, I think it worked in smarclient and ng the same way then. We moved away from smartclient, so I can’t really test anymore.

You can use other elements, some of them look off in certain clients ( looks off on my mac at least, is fine), we use and for our use case.

My thanks again.

all the best,

Terry