
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2025 05:44 AM
Hello, I have a single line txt type field that allow user to enter the name of the new group they want to create. Our stander format for group name start with "EY - group name " Ideally we want the field to pre-populated with CA- and then we need some way to ensure the user actually provide a name for the group, so that they don’t just submit requests saying group name is just "EY - ".
Any idea how to get this done?
Thanks,
S
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2025 05:51 AM
Hello @sparkles,
1. Client Script (onLoad) — Prepopulate the field
Create a Client Script:
Type: onLoad
Script:
function onLoad() {
var groupField = g_form.getValue('group_name'); // replace with actual field name
if (!groupField) {
g_form.setValue('group_name', 'CA - ');
}
}
2. Client Script (onSubmit) — Validate group name
Create another Client Script:
Type: onSubmit
Script:
function onSubmit() {
var groupName = g_form.getValue('group_name').trim();
// Check if it starts with "CA - " and has something after
if (groupName === 'CA -') {
alert('Please enter a valid group name after "CA -".');
return false;
}
// Optional: You can also enforce a regex to ensure more robust validation
var regex = /^CA -\s*\S+/;
if (!regex.test(groupName)) {
alert('Group name must start with "CA - " followed by a valid name.');
return false;
}
return true;
}
Please mark my response as Accepted and Helpful for future references.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2025 05:51 AM
Hello @sparkles,
1. Client Script (onLoad) — Prepopulate the field
Create a Client Script:
Type: onLoad
Script:
function onLoad() {
var groupField = g_form.getValue('group_name'); // replace with actual field name
if (!groupField) {
g_form.setValue('group_name', 'CA - ');
}
}
2. Client Script (onSubmit) — Validate group name
Create another Client Script:
Type: onSubmit
Script:
function onSubmit() {
var groupName = g_form.getValue('group_name').trim();
// Check if it starts with "CA - " and has something after
if (groupName === 'CA -') {
alert('Please enter a valid group name after "CA -".');
return false;
}
// Optional: You can also enforce a regex to ensure more robust validation
var regex = /^CA -\s*\S+/;
if (!regex.test(groupName)) {
alert('Group name must start with "CA - " followed by a valid name.');
return false;
}
return true;
}
Please mark my response as Accepted and Helpful for future references.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2025 12:34 PM
Thanks @anshul_goyal it works!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2025 11:55 PM
@sparkles Thanks for marking my solution!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2025 06:07 AM - edited 07-22-2025 06:08 AM
Hello @sparkles ,
In the field Default value of the variable, use "CA - "
Just a thought - There's a chance users might remove "CA-" and only enter the group name. So, when you create the group where your logic is stored, why not automatically prepend "CA- + <variable_value>?
Thank you.