The CreatorCon Call for Content is officially open! Get started here.

I want to put a link to an error message on a catalog item

arai keigo
Tera Contributor

When displaying an error message in a catalog item,
How do I embed a link in the error message?
The following code will display the error message.
Is there a best practice?

 

```

var link = '<a href=https://www.yahoo.co.jp/>Download Template</a>';
g_form.addErrorMessage(link);
```
4 REPLIES 4

Community Alums
Not applicable

Hi,

In the label variable, there is an option to link the text. Please try it.

Regards

Suman P.

arai keigo
Tera Contributor

Thanks for the answer!
Is there any way to link to the error message instead of the label variable?

Amit Gujarathi
Giga Sage
Giga Sage

Hi @arai keigo ,
I trust you are doing great.
Here's an example of how you can embed a link in the error message using JavaScript code:

 

var link = '<a href="https://www.yahoo.co.jp/">Download Template</a>';
g_form.addErrorMessage(link);

 

In this code, the link variable contains the HTML markup for the link. The href attribute specifies the URL that the link should navigate to, and the link text is displayed as "Download Template." The addErrorMessage() function is then used to display the error message on the catalog item form.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Hello! Mr. Amit!

 

I tried the source code, but first I get the following message in the editor,
When I actually run the code, I get a javascript execution error message.