- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 11:14 PM
Hi!
I have a field containing a string. For example "servicenow guru". I want to remove the space between "servicenow" and "guru" upon submitting the record. The value after submit should be "servicenowguru"). How to do this in a catalog client script?
Thanks!
Carlo
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 11:24 PM
If it is on client script;
var variable = g_form.getValue('variable name');
var variable1 = variable.toString().replace(/\s/g, '').trim();
g_form.setValue('variable name',variable1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 11:17 PM
Hello carlo,
You need to write an onchange cleint script, if you want user to know that spaces will be removed after he enters.
And also, you can onafter business rule if it is table form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 11:24 PM
If it is on client script;
var variable = g_form.getValue('variable name');
var variable1 = variable.toString().replace(/\s/g, '').trim();
g_form.setValue('variable name',variable1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2019 03:52 AM
Thanks budy!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 11:19 PM
This should do the trick:
=====
if(current.field1.indexOf(" ") >= 0)
var replaced = current.field1.split(' ').join('');
=====
Mark your feedback( Like or Helpful or Correct) as per the impact of my response. Cheers!
Vab