dynamically change the Helptext of a variable based on the choice selection of selectbox variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 09:19 PM
dynamically change the Helptext of a variable(description) based on the choice selection of selectbox variable(sub-category) on a catalog item on service portal.
i have tried writing onchange catalog client script with below script. it isn't working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 10:18 PM
Hi @NiloferS ,
Please try the below:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var helpText = '';
switch (newValue) {
case 'csr':
helpText = "Description about Business Item";
break;
case 'letterOfAuthority':
helpText = "Description about the matters requiring letter of approval";
break;
case 'power':
helpText = "Description about the matter requiring Power of Attorney";
break;
case 'board':
helpText = "Description about the resolution ";
break;
default:
helpText = "Please select a sub-category";
}
var descriptionField = g_form.getField('description');
if (descriptionField) {
descriptionField.expand_help = true;
descriptionField.help_tag = helpText;
descriptionField.instructions = helpText;
}
}
Please hit like and mark my response as correct if that helps.
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 10:55 PM
Probably easier to show field message under description field rather than help text. You can use g_form.showFieldMsg in your client script to show whatever message you want under description field. You can build your conditions as you did above and use this and show message accordingly.
var description_text = "Description message here";
g_form.showFieldMsg('description', description_text, 'info');