- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2025 09:59 AM
Hello! The requirement is to retain the OOB type of a field which is List but prevents users from selecting multiple values.
Is there a way to script it with an info message to select only one? Thank you
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2025 10:24 AM
You can achieve this with onchange or onsubmit client script with below code.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) return;
var values = g_form.getValue('your_list_field_name').toString().split(',');
if (values.length > 1) {
alert('Please select only one value.');
// Keep only the first selected item
g_form.setValue('your_list_field_name', values[0]);
}
}
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2025 10:03 AM
Hi there @Momiji
Yes, you can keep the field type as List but still restrict it to a single selection using a client script. use an onChange client script that checks the length of selected values. If the user selects more than one, you can display an g_form.showFieldMsg() or g_form.addInfoMessage() telling them to select only one, and then clear the extra values. This way, you don’t have to change the field type to Choice.
If this helps kindly accept the solution
Kind Regards,
Mohamed Azarudeen Z
Developer @ KPMG
Microsoft MVP (AI Services), India

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2025 10:24 AM
You can achieve this with onchange or onsubmit client script with below code.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) return;
var values = g_form.getValue('your_list_field_name').toString().split(',');
if (values.length > 1) {
alert('Please select only one value.');
// Keep only the first selected item
g_form.setValue('your_list_field_name', values[0]);
}
}
Regards,
Musab

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2025 11:34 PM
@Momiji If my code is working, kindly accept solution and close the thread.
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2025 10:37 AM
Hello @Momiji
You can write on change client script for that :
Table : select the table
Type : On change
Field : select the field
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
// Split the newValue into an array (it’s comma-separated for list fields)
var selectedValues = newValue.split(',');
if (selectedValues.length > 1) {
// Show alert popup
alert('Please select only one value.');
// Reset the value to the first selection only
g_form.setValue('u_test', "selectedValues[0]");
}
}
In place of "u_test" write your field name at the end for set value.
Hope this helps!
I tried it on PDI and its working. Feel free to ask if you have any doubt.
If it helps, mark the solution as accepted.
Thank you!
Shashank Jain