Show 2 different help texts or 2 different field messages based on other variable choice on a (CI)

Insider
Giga Guru

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

3 REPLIES 3

BharathChintala
Mega Sage

@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.

Prasad Dhumal
Mega Sage

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>');
}

 

Basheer
Mega Sage

Hi @Insider 

showFieldMessage() function doesn't support HTML. If you want to add link, you have to use addInfoMessage().