restrict the semicolumn (;) in string filed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 02:18 AM
when user fill (; )it will not allow replace (; )with (,) and update field how can i achive, provide me any source code for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 02:24 AM
Hi @Gillerla Rajesh ,
Try the below :
var input = current.<nameofyourfield>.toString();
var output = input.replace(";", ",");
// add your update logic
gs.print(output);
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 03:47 AM
Assuming you want to enforce these restrictions on a catalog field, you can make use of an On-Change Catalog Client Script on your field with below code :
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var inputString = g_form.getValue('description'); // change the field name as per your field
var output = inputString.replace(";", ",");
g_form.setValue('description', output); // Change the field name as per your field
}
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 03:54 AM - edited 02-28-2024 03:55 AM
Hi@Gillerla Rajesh ,
You can write on change client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 04:25 AM
Hello @Gillerla Rajesh ,
you can try below code-
var input = current.getValue(current.sys_id);
var output = input.replace(";", ",");
current.setValue(current.sys_id,output);
if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
CB