4

Recently I received client requirements for validation Component fields using Event System. I am facing issue in message with multiple lines.

throw new Exception(“Experience must <br> be greater <br> than 10”);

The <br> tag is not working in the Tridion GUI message.

looking for solutions and ideas.

enter image description here

3 Answers 3

9

You would have to make CSS updates through a GUI extension besides using the new line (\n) in your exception message.

  • In your event system exception, you will be using the new line like this:

    throw new Exception("Some text before new line.\nSome text after new line.");

  • In the GUI extension, set the CSS white-space property to pre-wrap in the div element of the notification message.

    white-space: pre-wrap;

enter image description here

5

Assuming it's C# .NET, you can try using the Environment.NewLine property from the System namespace. NewLine actually equals \r\n.

String.Format("NewLine: {0}  first line{0}  second line{0}  third line",
                          Environment.NewLine);
1
  • I tried and not worked. Commented Jan 23, 2020 at 15:37
0

Did you try xhtml line break

<br/>?

1
  • I tried and not worked <br/> tag. Commented Jan 23, 2020 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.