- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 07:16 AM - edited 11-07-2023 07:17 AM
Thank you for your help.
I am working on the following three requirements.
All of them will be the behavior before the update.
-True/False field and a Date field.
-If the True/False field is false, the Date field should have a showFieldMsg and the showFieldMsg should not disappear when a value is entered.
-If the True/False field is true, showFieldMsg should disappear.
■ShowFieldMsg is displayed when True/False(checkbox) field is false and a value is entered in Date field (before update).
■When "True/False(checkbox)" field is set to "true", "showFieldMsg" in Date field is turned off (before update).
Initially, we determined that this could be achieved with a UI policy, so we created a UI policy with scripts.
However, the onCondition() script was able to dynamically show/hide showFieldMsg due to True/False changes, but when a Date value is entered, showFieldMsg disappears.
Therefore, we used a client script and created the following onChange() script.
With the client script, showFieldMsg did not disappear when a value was entered, but it was not possible to show/hide showFieldMsg dynamically by changing True/False.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
// if (isLoading || newValue === '') {
// return;
// }
//Type appropriate comment here, and begin script below
if(g_form.getValue('u_checkbox_test') === 'false'){
g_form.showFieldMsg('u_date_test', 'date_description','info');
}else if(g_form.getValue('u_checkbox_test') === 'true'){
g_form.hideFieldMsg('u_date_test');
}
}
I am not familiar with client scripting, so can this requirement be accomplished in client scripting?
Other ways to achieve this would be welcome.
Thank you in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 07:22 AM
Hi @N_Y_1014
You'll need to use this script twice.
Once triggered onchange on the checkbox, once triggered onChange on the date field.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 07:22 AM
Hi @N_Y_1014
You'll need to use this script twice.
Once triggered onchange on the checkbox, once triggered onChange on the date field.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 06:42 PM
The requirement was achieved by creating onChange scripts for the checkbox and Date fields respectively in the client script.
In addition, by using oldValue, newValue, and isLoading, it was possible to dynamically show/hide the showFieldMsg even if the checkbox field's True/False value changes or the Date field's value is entered.
Thanks to both of you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 07:25 AM
Hi @N_Y_1014 ,
Try below script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === 'false') {
g_form.showFieldMsg('u_date_test', 'This is a message for the Date field when checkbox is false', 'info');
} else {
g_form.hideFieldMsg('u_date_test');
}
}
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 07:56 AM
Hi @N_Y_1014 ,
Working fine in my pdi
Please mark it as solution proposed and helpful if its serves your purpose.
Thanks,
Anand