Show 2 different help texts or 2 different field messages based on other variable choice on a (CI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 03:13 AM
Hello developers,
Variable A has 2 options 1 and 2
When Variable A is selected as =1
then Variable B must show a message or a help text or a info message saying "1".
When Variable A is selected as =2
then Variable B must show a message or a help text or a info message saying "2".
I have tried out using g_form.showFieldMsg, it worked but i need to include a hyperlink with in these messages so adding a hyperlink in FieldMsg is not possible.
Please suggest what can be done? any other ways? any widget suggestion or some new approach
Thanks,
insider
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 05:14 AM
@Insider you can create labels 1 and 2 for message1 and 2 and write UI policy when variable is A show label 1 and variable B is Label 2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 08:55 AM
Hello,
If Variable A is set to 1, you can use the following code in the Client Script to set the value of Variable B to a message with a hyperlink:
if (g_form.getValue('Variable A') == '1') {
g_form.setValue('Variable B', '<a href="https://www.example.com">1</a>');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 09:02 AM
Hi @Insider
showFieldMessage() function doesn't support HTML. If you want to add link, you have to use addInfoMessage().