Everyone know the classic line of code to generate custom error message:
throw new oracle.jbo.ValidationException(“MESSAGE HERE”)
But we can make use of HTML to make this error message a bit more exiting as below.
1 – Create Multi Line Validation Messages.
a) Lines are Close Together
– for this we use brake line html tag <br>
throw new oracle.jbo.ValidationException(“<html><body><p>MESSAGE 1 <br> MESSAGE 2 <br> MESSAGE 3 <br> MESSAGE 4</p></body></html>”)
b) Lines have a space between them.
– for this we use multiple <p> tags
throw new oracle.jbo.ValidationException(“<html><body><p>MESSAGE 1 </p><p> MESSAGE 2 </p><p> MESSAGE 3 </p><p> MESSAGE 4</p></body></html>”)
2 – Create Bold Validation Messages
– for this we can use the <b> tag
throw new oracle.jbo.ValidationException(“<html><body><b>This is Bold Message</b> And This is Not</body></html>”)
3 – Add A link to your Error Message that can be clicked
-we use <a href = “address”> text </a> tags
def x = “https://www.w3schools.com”
throw new oracle.jbo.ValidationException(“<html><body>Clicl The Following Link: <a href=${x}>Visit W3Schools</a></body></html>”)
4 – Make Italic Message
– we can use <i> tag
throw new oracle.jbo.ValidationException(“<html><body>This is <i>ITALIC </i> Message </body></html>”)