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) < jlock...@gmail.com> 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"_ _______________________________________________________________________________ UNSUBSCRIBE or access ARSlist Archives at www.arslist.org attend wwrug12 www.wwrug12.com ARSList: "Where the Answers Are"