- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 04:56 AM
Hi,
I have a variable named proxy and it has 4 options None, Yes, No, Not applicable. Whenever the user selecting Yes under the field I want a message "Archer request required" should populate. How to do that can anyone pls help. Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 05:35 AM - edited 09-17-2024 05:55 AM
Hi @Raji15,
Containers are used to display variables either as a single field in a row or two fields in a row.
I Tried in my PDI , It is Working Fine
The issue is not related to the containers. Please review the backend values of the variables and choices, and try again.
Thanks and regards,
Badrinarayan"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 05:17 AM
Hi @Raji15 ,
To display a field message beneath the field when an option is selected, you can use the showFieldMsg() function.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return; // Don't do anything while the form is loading
}
// Clear any previous messages
g_form.hideFieldMsg('Your_field_name');
// Show messages based on the new value
if (newValue == 'yes') {
g_form.showFieldMsg('Your_field_name', 'Message 1', 'error');
} else if (newValue == 'no') {
g_form.showFieldMsg('impact', 'Message 2', 'error');
}
}
Please mark my solution as helpful and accept it if your issue has been resolved.
Thanks Regards
Badrinarayan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 05:30 AM
Not working. The variable is inside the container. Is that cause any problem may be?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 05:35 AM - edited 09-17-2024 05:55 AM
Hi @Raji15,
Containers are used to display variables either as a single field in a row or two fields in a row.
I Tried in my PDI , It is Working Fine
The issue is not related to the containers. Please review the backend values of the variables and choices, and try again.
Thanks and regards,
Badrinarayan"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 05:38 AM
Hello @Raji15 ,
Please follow this KB article to show a field message for the variable inside the container.
Please mark my answer as accepted solution and give thumbs up, if it helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 06:10 AM - edited 09-17-2024 06:27 AM
Hi @Raji15
When dealing with variables inside containers, you still use the g_form.getValue() and g_form.showFieldMsg() functions, but ensure that the variable name you’re using in the script matches the name defined in the catalog item.
// Client Script to show message based on proxy variable selection
(function() {
// Get the selected value of the 'proxy' variable
var proxyValue = g_form.getValue('proxy');
// Check if the value is 'Yes'
if (proxyValue == 'Yes') {
// Display a message to the user
// g_form.addInfoMessage('Archer request required');
g_form.showFieldMsg('Your_field_name', 'Message 1', 'error');
} else {
// Clear the message if the value is not 'Yes'
g_form.clearMessages();
}
})();
i hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
rajesh