- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2017 09:08 AM
Hi All ,
can you please help me on the below :
As a past of integration , i need to remove special symbols DYNAMICALLY (Chinese/some strange symbols) in the description (XML not accepting these symbols) . i tried like below but not getting how to push the unwanted value in to another Array. below is the onchange client script on a filed , can some one please help me in achieving this . Thank you
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
*****
//Type appropriate comment here, and begin script below
if ( newValue == 'XXXX' || 'YYYY' || 'ZZZZ')
{
alert("hello");
var val = [];
val = g_form.getValue('description');
alert(val);
var achar =[];
achar = 'abcdefghijklmnop'; //need to add 26 alphabets here
var k=0;
var result;
var i;
var array = [];
var answer =[];
var array1 = val.toLowerCase().split('');
for ( i=0; i <=val.length; i++){
{
//alert("first forloop");
for (var j=0; j <=achar.length; j++)
{
if(val[i] != achar[j]) // up to this point processor works tried with some alerts , here not working
{
array.push(val[i]);
k++;
}
}
}
}
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2017 09:07 PM
Here is how you can remove the special characters
var new_desc=g_form.getValue('description').toString().replace(/[^a-zA-Z ]/g, "");

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2017 09:07 PM
Here is how you can remove the special characters
var new_desc=g_form.getValue('description').toString().replace(/[^a-zA-Z ]/g, "");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2017 09:38 PM
Include alphanumeric and only replace special characters.
var new_desc=g_form.getValue('description').toString().replace(/[^a-zA-Z0-9]/g, '');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2017 11:00 PM
Hi Abinay/Rakesh ,
Thanks for your prompt response, the proposed solution is working now . Thanks again