Thanks for the input guys.   

 

In reference to Axton's suggestion - I'm certainly not a Java guy, but might
be able to find some internal resources to tap into on that front.  In the
meantime, Jason's suggestion of a VB or batch file script might be good
quick and dirty solution to buy us more time to implement something more
elegant.  Thanks again!

 

Cheers,

Jeff

 

 

From: Action Request System discussion list(ARSList)
[mailto:[email protected]] On Behalf Of Jason Miller
Sent: Wednesday, May 16, 2012 2:58 PM
To: [email protected]
Subject: Re: Cleaning Special Characters from a Character Field

 

** I agree.  I haven't had a chance to write a plugin yet but we have a few
cases where we built DB functions or server side scripts (.vbs, .bat) that
we call from a Filter using Direct SQL or Run Process.  It isn't as elegant
as what Axton describes but is more or less the same concept; off load the
works to an external process on the server to do the work and give the
result back to Remedy.

 

Jason

On Wed, May 16, 2012 at 11:41 AM, Axton <[email protected]> wrote:

** I would not use client side technologies for data validation or
sanitization; at some point someone or something will bypass it (api, web
service, import, workflow, etc.).  I wrote a Java plugin that uses the java
regex capabilities to do something similar.  It relatively simple to write
and you can pass the regex parameters to the plugin; just figure out what
you want to give to the plugin and what you want to get back, then fill in
the blanks with the Java.

 

http://docs.oracle.com/javase/tutorial/essential/regex/ 

http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html 

http://docs.oracle.com/javase/6/docs/api/java/util/regex/Matcher.html 

The following classes should have all you need:

java.util.regex.Pattern

java.util.regex.Matcher

 

Axton Grams

 

On Wed, May 16, 2012 at 11:49 AM, Jeff Lockemy (QMX Support Services)
<[email protected]> wrote:

** 

Good Day Listers,

I've been going round and round on this and I hope that someone has some
suggestions.

I need to strip out special/non-standard characters in a character field
before passing it to a web service.  I was thinking that running some
JavaScript when the user submits the contents via the Mid-Tier might be a
decent approach.  Not really knowing JavaScript, I dug around and found a
"removeSpecialChars" function on the web that I was trying to adapt, but I
haven't had much luck.

Based on examples that I found on the ARSList and BMC Community, I put the
function in the Web Footer Content of the form:

<html>

<script>

function removeSpecialChars(strVal)

{

strVal = strVal.replace(/[^A-Za-z 0-9
\.,\?""!#\$%\^&\*\(\)-_=\+;:<>\/\\\|\}\{\[\]`~]*/g, '') ;

}            

</script>

<body> 

</body>

</html>

 

Then I tried several different Active Link Run Process commands to run the
function on submit or modify:

javascript:window.F(536870913).S(removeSpecialChars($Character Field$));

javascript:window.F(536870913).S(new CharType(removeSpecialChars
("arid536870913").value));

However, when I submit or modify the field contents, I always get the
following error:

Caught exception: Object doesn't support property or method 'hasMessages'

Now I'm wondering if JavaScript is really the best way to approach this.  If
JavaScript is a good approach, then can anyone see what I am doing wrong
here?  If it isn't, any suggestions of a better way?

Thanks in advance.

Respectfully,

Jeff

 

 

_attend WWRUG12 www.wwrug.com ARSlist: "Where the Answers Are"_

 

_attend WWRUG12 www.wwrug.com ARSlist: "Where the Answers Are"_ 

 

_attend WWRUG12 www.wwrug.com ARSlist: "Where the Answers Are"_ 


_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug12 www.wwrug12.com ARSList: "Where the Answers Are"

Reply via email to