Add hints to choices via script

Jake Sadler
Kilo Sage

Hi,

 

I am using an oChange client script to add or remove options to a choice list field.

 

The original choices have hints on attached them when you hover over them but if these options get removed and then added back using the g_form.addOption() method the hint does not come back with the option.

Is there a solution for this?

1 ACCEPTED SOLUTION

Okay. I don't see any OOB way to achieve this. The only way would be to do DOM manipulation which is not recommended. (and I am not good in DOM manipulation 😛 )

If your choice field is dependent on other field value then you can try dependent choice configuration.

 

https://docs.servicenow.com/bundle/sandiego-platform-administration/page/administer/field-administra...

https://community.servicenow.com/community?id=community_question&sys_id=2e05b490db214510f77799ead396...

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

9 REPLIES 9

A hint is added to the option tag using the title attribute.  So you should be able to take the small sample of code and use it to add a title to the option you just added.

 

Anil Lande
Kilo Patron

Hi,

Please check if below link resolve your issue, had shared solution for similar issue. 

https://community.servicenow.com/community?id=community_question&sys_id=b8db38fedba14110ae8125091396...

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hi,

 

Thanks for link for the workaround but I'm trying to keep the ability to hover over the choice to get the hint to display.

Okay. I don't see any OOB way to achieve this. The only way would be to do DOM manipulation which is not recommended. (and I am not good in DOM manipulation 😛 )

If your choice field is dependent on other field value then you can try dependent choice configuration.

 

https://docs.servicenow.com/bundle/sandiego-platform-administration/page/administer/field-administra...

https://community.servicenow.com/community?id=community_question&sys_id=2e05b490db214510f77799ead396...

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hitoshi Ozawa
Giga Sage
Giga Sage

As others have replied, the only way now is to use DOM manipulation as described with example in the following thread. DOM manipulation is not recommended because it may not works when ServiceNow is versioned up.

https://community.servicenow.com/community?id=community_question&sys_id=262187e5db98dbc01dcaf3231f96...