Replace special characters in FDF

Hello,
I have searched everywhere and cannot find the answer to this simple problem.  I can manipulate javascript in an HTML environment by using free scripts, but it's not so easy in a PDF form.  I am using Adobe Acrobat 9 Pro and I have a form that when filled out and submitted, generates and emails an FDF file.  I am using a server-side script called FormGenie to do this, and the script hates parentheses and some other special characters, they break the FDF file.  All I want to do is set up a document level Javascript that will check for and replace all instances of these special characters with something allowed like a hyphen- or just a space.
I have tried:
function clearText() {
     document.formname.fieldname.value=filterNum(document.formname.fieldname.value)
     function filterNum(str) {
          re = /\$|#|~|\%|\*|\^|\(|\)|\+|\=|\[|\]|\[|\}|\{|\;|\"|\<|\>|\?|\||\\|\!|\$/g;
          // remove special characters like "$" and "," etc...
          return str.replace(re, "-");
and
function clearText2(str) {
stringName = stringName.replace(/\$|#|~|\%|\*|\^|\(|\)|\+|\=|\[|\]|\[|\}|\{|\;|\"|\<|\>|\?|\||\\|\!|\$ /g,'-');
I know these aren't right, but I have to be at least barking up the right tree.
Can someone help?
Thank you

OK, here is my first stab at putting together this  script from searching the API reference.
To loop  through the text fields and get their values, I have:
for  ( var i = 0; i < this.numFields; i++) {
var fname = this.getNthFieldName(i);
if ( fname.type = "text" ) f.value;   [Not sure if "f.value" is correct or legal here]
If this is even getting close, where I get stuck  is how to get the original script to take those values and replace any unwanted characters found.
if (!event.willCommit) {
    event.change = event.change.replace(/[\$\#\~\%\*\^\(\)\+\=\[\]\{\}\;\"\<\>\?\|\\\!]/g, "-");
I just need to put this together correctly and I don't know how.
I have the form submission part down, that was already done, I just need to add the custom "Run a javascript" item above it so that is executed first.
Need a little guidance,
Thanks

Similar Messages

  • How to replace special characters in string.

    Hello,
    I want to replace special characters such as , or ; with any other character or " ".I find out there is no such function is java for this.There is only replace() but it accepts only chars.If anybody know how to do this?.
    Thanks,

    Hello,
    I want to replace special characters such as , or ;
    with any other character or " ".I find out there is no
    such function is java for this.There is only replace()
    but it accepts only chars.If anybody know how to do
    this?.
    Thanks,Can't you just do the following?
    public class Test
         public static void main(String[] args)
         String testString = "Hi, there?";
         System.out.println(testString.replace(',',' '));
    }

  • Vbscript to rename files and replace special characters

    Dear Exprt,
    would you please help to add addtional requirement for rename and replace special characters for file
    by the below script i can re name.
    strAnswer = InputBox("Please enter folder location to rename files:", _
        "File rename")
        strfilenm = InputBox("Enter name:", _
        "Rename Files")
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Sub visitFolder(folderVar)
        For Each fileToRename In folderVar.Files
            fileToRename.Name = strfilenm & fileToRename.Name
        Next
        For Each folderToVisit In folderVar.SubFolders
            visitFolder(folderToVisit)
        Next
    End Sub
    If FSO.FolderExists(strAnswer) Then
        visitFolder(FSO.getFolder(strAnswer))
    End If
    [email protected]

    Thx would you please look below what wrong in its run  nothing happend no error
    strAnswer = InputBox("Please enter folder location to rename files:", _
        "Test")
        strfilenm = InputBox("Enter name:", _
        "Rename Files")
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set regEx = New RegExp
    'Your pattern here
    Select Case tmpChar
    Case "&"
    changeTo = " and "
    Case "/"
    changeTo = "_"
    Case Else
    changeTo = " "
    End Select
    regEx.Pattern = tmpChar 
    Sub visitFolder(folderVar)
        For Each fileToRename In folderVar.Files
            fileToRename.Name = strfilenm & fileToRename.Name 
            fileToRename.Name = regEx.Replace(fileToRename.Name, tmpChar)
        Next
        For Each folderToVisit In folderVar.SubFolders
            visitFolder(folderToVisit)
        Next
    End Sub
    [email protected]

  • How to replace special characters in Purchase order item text in ECC 6.0

    Hi All,
    Now i am working in ECC environment.
    I am unable to replace the special characters in the PO short text for example take the following text.
    Job#Burst Fire 3930-00092#Heater Control
    here i want to replace # symbol with space.
    i used  replace all occurences, find , transfer, overlay keywords to replace thta special characte but it is not replacing that character.
    i used replace_string FM also.it is also not working.
    please help me out in this. points will be rewarded.

    Hi Praveena,
    what replacement(s) did you try?
    Please
    replace all occurrences of
    CL_ABAP_CHAR_UTILITIES=>newline
    CL_ABAP_CHAR_UTILITIES=>cr_lf
    CL_ABAP_CHAR_UTILITIES=>form_feed
    CL_ABAP_CHAR_UTILITIES=>horizontal_tab
    CL_ABAP_CHAR_UTILITIES=>vertical_tab
    CL_ABAP_CHAR_UTILITIES=>backspace
    CL_ABAP_CHAR_UTILITIES=>minchar
    CL_ABAP_CHAR_UTILITIES=>maxchar
    minchar is HEX u201900u2018 in non-Unicode systems, U+0000 in Unicode systems
    maxchar is HEX  Xu2018FFu2018 in non-Unicode systems, U+FFFD in Unicode systems
    If it still does not help, check the remaining # characters in debugger, switching to hex mode: Then you may see what it is.
    Regards,
    Clemens

  • Replacing special characters from xml document/text inside element

    Hi
    Is there any way to replace the xml codes to special characters inside an entire xml document/ for a text in element.
    I want to get the xml codes to get replaced to respective special character(for any special character)
    Please see the sample xml xml element below
    <Details>Advance is applicable only for &lt; 1000. This is mentioned in Seller&apos;s document</Details>
    Thanks in advance .. any help will be highly appreciated.

    So, just to be sure I understand correctly, you want this :
    <Details>Advance is applicable only for &lt; 1000. This is mentioned in Seller&apos;s document</Details>
    to be converted to :
    <Details>Advance is applicable only for < 1000. This is mentioned in Seller's document</Details>
    If so, I'll say again : the resulting XML document will be invalid.
    Extensible Markup Language (XML) 1.0 (Fifth Edition)
    The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they MUST be escaped using either numeric character references or the strings " &amp; " and " &lt; " respectively. The right angle bracket (>) may be represented using the string " &gt; ", and MUST, for compatibility, be escaped using either " &gt; " or a character reference when it appears in the string " ]]> " in content, when that string is not marking the end of a CDATA section.
    Ask whoever "they" are why they would want to work with not wellformed XML.

  • Need help in replacing special characters in a string

    Hi,
    please let me know the best way to replace all the special characters in a string with space.
    other than alphabets and numbers
    with regards.
    sumanth.

    please let me know the best way to replace all the special characters in a string with space.
    other than alphabets and numbers
    >
    Sumanth Nag Kristam wrote:
    > actually i need to replace hexa decimal char 0X1A in a string.... that is 'substitue' as per the chart
    > any pointers....
    >
    > chk the link for the ASCII codes
    > http://www.techonthenet.com/ascii/chart.php
    But in Hexa decimal value there is no special characters?

  • Replace Special Characters in a string + XQUERY

    Hi All,
    I am using the following replace function to replace the special characters in my XQUERY.
    *replace($string1, '[&"-*;-`!|:,¿/{}@#$%^*~()_+-]', ' ')*
    Fortunately it is replacing all the special characters. But the only problem here is it is even replacing capitol letters in to spaces, which I don't want.
    Please help me out!!

    Hi
    <<< What did u change >?> I dont see any change with the Regex ?  >>
    if you observe in the modified function, he just removed (*) inside the replace funtion.
    Thanks
    Shankar AUNV

  • Replacing 'special' characters

    Hi all,
    I was wondering if thers is a function module, class (method) or whatever (codepage translation) to convert 'special' characters like:
    è, é, ë, ï, etc with respectively e, e, e, i?
    More generally speaking we need to convert all characters (whether it be Unicode, Latin-1, etc.) to plain text containing only the letters of the alphabet from a-z and A-Z.
    Kind regards,
    Micky.

    @ Rainer,
    both thanks a lot for your relevant replies which are quite helpful. And I do think that we still needs some sort of intermediate table to hold at least some characters to be translated/converted into plain text.
    @ Gautham,
    I'm currently testing this function module with several codepages (parameter INTER_CP) beside the default codepage 1146. For characters like ë and ï this is definitely the way to go, but when using some characters that are really out there like ¥ŖßÞu0152u03A9u03C6, we still seem to be needing an intermediate table to replace these characters.
    But again, some very helpful answers.
    P.S. Although both answers are potentially worth 10 pts, It only seems fair to give you both the credit you deserve.

  • Replace special characters

    Hi,
    I want to rename files containg special characters in a directory tree.
    For example I want
    06\ --\ Doppelgänger.flac
    renamed to
    06\ --\ Doppelganger.flac
    I have found a python script that seems to be able to do it here.
    I have also found a list of replacements characters
    my $AccentedChars = '€–‚ƒ„…†‡ˆ‰Š‹Œ–Ž––''""•–—˜™š›œ–žŸ'.
    '–¡¢£¤¥¦§¨©ª«¬-®¯°±²³´µ¶·¸¹º»¼½¾¿'.
    'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß'.
    'àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ';
    my $NonAccenChars = 'E-,f,.++^%S_O-Z--````.--~Ts_o-zY'.
    '-!cLoYlS`Ca_--R-`+23`uP.,10_qh3_'.
    'AAAAAAACEEEEIIIIDNOOOOOxOUUUUYTS'.
    'aaaaaaaceeeeiiiidnooooo%ouuuuyty';
    from this perl script (which throws an error when used. Otherwise it would be perfect).
    So, can somebody tell me how I could feed the python script with the above replacement table?
    I have tried but I can't seem to get it to work.
    I have also tried to make a simple bash-script using rename but I could not that to work either.
    I would really appreciate any help.
    Thanks,
    Rasmus

    I didn't try the perl script, but sed's y command will do exactly this. tr complains about a dash
    accent='€–‚ƒ„…†‡ˆ‰Š‹Œ–Ž––''""•–—˜™š›œ–žŸ–¡¢£¤¥¦§¨©ª«¬-®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'
    nonaccent='E-,f,.++^%S_O-Z--````.--~Ts_o-zY-!cLoYlS`Ca_--R-`+23`uP.,10_qh3_AAAAAAACEEEEIIIIDNOOOOOxOUUUUYTSaaaaaaaceeeeiiiidnooooo%ouuuuyty'
    echo '06\ --\ Doppelgänger.flac' | sed "y/$accent/$nonaccent/"
    So you could do something like
    for file in *; do
    mv -v -i -- "$file" "$(echo "$file" | sed "y/$accent/$nonaccent/")"
    done

  • Search & Replace special characters?

    Is there a way to search & replace for special characters, such as paragraph or tab marks?

    Not in Pages 5.2 because Apple made it new and improved.
    However both Pages '08 and Pages '09 can search on invisible characters, precisely because they are not new and improved.
    Peter

  • Replace special characters in String

    Dear Guru ,
    Does SAP provide the standard function that can replace the special characters in String ?
    For example :
    I have one template string : " & & & & & output(s) have not been processed yet ! " and five parameters : "P1" , "P2" , "P3" , "P4" , "P5" .
    And i would like to apply all parameters into the string to replace the "&" character . Is it possibile ?
    My idea is sourcing from the Message String that in tcode : SE91 .
    Thanks .
    Best Regards,
    Carlos Zhang

    Hi Carlos,
    I think instead of a standard FM you can write a one line command to do this job.
    E.g. 
    constant: str1 type string value 'output(s) have not been processed yet ! '.
    data: var1 type c,
             var2 type c,
             var3 type c,
             var4 type c,
             str    type string.
    concatenate var1 var2 var3 var4 str1 into str separated by space.
    So str will have the final value.
    Thanks,
    Mainak

  • Find and replacing special characters

    we have just discovered that after database unicode conversion, some special characters are starting to appear in the database after users copy and paste into the database.
    For example from a table, we can identify it with:
    SQL> select count(*) from table where column_name like '%' || chr(25) || '%';
    COUNT(*)
    15
    This is for a table.
    How can this be done to identify the characters for all tables because we are not sure of all the tables
    Thanks

    Hi,
    Please try below pl/sql block to identify special characters in tables with respect to columns
    set serveroutput on size 1000000
    declare
    procedure gooey(v_table varchar2, v_column varchar2) is
    type t_id is table of number;
    type t_dump is table of varchar2(20000);
    type t_data is table of varchar2(20000);
    l_id t_id;
    l_data t_data;
    l_dump t_dump;
    cursor a is
    select distinct column_name
    from dba_tab_columns
    where table_name = v_table
    and data_type = 'VARCHAR2'
    and column_name not in ('CUSTOMER_KEY','ADDRESS_KEY');
    begin
    for x in a loop
    l_id := null;
    l_data := null;
    l_dump := null;
    execute immediate 'SELECT ' || v_column || ', ' || x.column_name || ', ' ||
    'dump(' || x.column_name || ')'
    || ' FROM ' || v_table
    || ' WHERE RTRIM((LTRIM(REPLACE(TRANSLATE(' || x.column_name ||
    ',''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@#$%^&*()_+
    -=,!\`~{}./?:";''''[ ]'',''A''), ''A'', '''')))) IS NOT NULL'
    bulk collect into l_id, l_data, l_dump;
    if l_id is not null then
    for k in 1..l_id.count loop
    dbms_output.put_line(v_table || ' - ' || x.column_name || ' - ' ||
    to_char(l_id(k),'999999999999'));
    dbms_output.put_line(l_data(k));
    dbms_output.put_line(l_dump(k));
    dbms_output.put_line('*********************');
    end loop;
    end if;
    end loop;
    end gooey;
    begin
    gooey('table1','coln1');
    gooey('table1','coln2');
    gooey('table2','coln3');
    end;
    Like this you can get special characters for all the columns/particular column from table
    Thanks,
    Nitin

  • Looking for, and replace special characters

    Hi
    I am quite new to AppleScript and can't figure this out. Any help would be appreciated.
    I have received several (a lot of) folders containing images with some strange characters in the file names. The images has to go to web, and I want to replace those characters with some that are web friendly. The characters in question is some Swedish A's and O's (Ä, ä, Ö, ö) and one that looks like the Apple Command symbol. (I was told this one is a combination of a and e).
    Then, I would like to replace all spaces between the words in the file names with an underscore.
    In addition, all image file names start with capitals and I would like to replace these as well.
    Thanks
    Neal
    G5   Mac OS X (10.4.6)  

    Here's a modified version of the standard script:
    try
    tell application "Finder" to set the source_folder to (folder of the front window) as alias
    on error -- no open folder windows
    set the source_folder to path to desktop folder as alias
    end try
    display dialog "Search and replace in:" buttons {"File Names", "Folder Names", "Both"} default button 3
    set the search_parameter to the button returned of the result
    repeat
    display dialog "Enter text to find in the item names:" default answer "" buttons {"Cancel", "OK"} default button 2
    set the search_string to the text returned of the result
    if the search_string is not "" then exit repeat
    end repeat
    repeat
    display dialog "Enter replacement text:" default answer "" buttons {"Cancel", "OK"} default button 2
    set the replacement_string to the text returned of the result
    if the replacement_string contains ":" then
    beep
    display dialog "A file or folder name cannot contain a colon (:)." buttons {"Cancel", "OK"} default button 2
    else if the replacement_string contains "/" then
    beep
    display dialog "A file or folder name cannot contain a forward slash (/)." buttons {"Cancel", "OK"} default button 2
    else
    exit repeat
    end if
    end repeat
    display dialog "Replace “" & the search_string & "” with “" & the replacement_string & "” in every item name?" buttons {"Cancel", "OK"} default button 2
    tell application "Finder"
    set the item_list to every item of entire contents of source_folder
    tell me
    set item_list to reverse of the item_list
    end tell
    set source_folder to source_folder as string
    repeat with i from 1 to number of items in the item_list
    set the_name to name of item i of the item_list
    set this_item to item i of the item_list
    set this_info to properties of this_item
    set the current_name to the_name
    set change_flag to false
    repeat with this_char from 1 to (count items of search_string)
    if the current_name contains item this_char of (search_string) then
    if the search_parameter is "Folder Names" and ¬
    folder of this_info is true then
    set the change_flag to true
    else if the search_parameter is "File Names" and ¬
    folder of this_info is false then
    set the change_flag to true
    else if the search_parameter is "Both" then
    set the change_flag to true
    end if
    if the change_flag is true then
    set this_item to item i of the item_list
    -- replace target string using delimiters
    set AppleScript's text item delimiters to the item this_char of search_string
    set the textitemlist to every text item of the current_name
    set AppleScript's text item delimiters to the item this_char of replacement_string
    set the newitemname to the textitemlist as string
    set AppleScript's text item delimiters to ""
    set the current_name to newitemname
    end if
    end if
    end repeat
    my setitem_name(thisitem, current_name)
    end repeat
    end tell
    beep 2
    on setitem_name(thisitem, newitemname)
    tell application "Finder"
    --activate
    set the parentcontainerpath to (get the container of this_item) as text
    if not (exists item (the parentcontainerpath & newitemname)) then
    try
    set the name of this_item to newitemname
    return this_item
    on error the error_message number the error_number
    if the error_number is -59 then
    set the error_message to "This name contains improper characters, such as a colon (:)."
    else --the suggested name is too long
    set the error_message to error_message -- "The name is more than 31 characters long."
    end if
    --beep
    tell me to display dialog the error_message default answer newitemname buttons {"Cancel", "Skip", "OK"} default button 3
    copy the result as list to {newitemname, button_pressed}
    if the button_pressed is "Skip" then return 0
    my setitem_name(thisitem, newitemname)
    end try
    else --the name already exists
    --beep
    tell me to display dialog "This name is already taken, please rename." default answer newitemname buttons {"Cancel", "Skip", "OK"} default button 3
    copy the result as list to {newitemname, button_pressed}
    if the button_pressed is "Skip" then return 0
    my setitem_name(thisitem, newitemname)
    end if
    end tell
    end setitemname
    This script variant works by accepting a source string in the form "AB" and desired string "CD". When run, ABCA will become CDCC with the sample strings.
    (19254)

  • Replace Special Characters in a String

    Let's say someone copies the folowing list and pastes it into a Javascript prompt box:
    302304
    305678
    245675
    How do I manipulate the string so it reads:
    302304 305678 245675
    In other words, how do I replace the manual line breaks in a string with spaces?
    Thanks!

    \r and \n are both \s characters.
    This is functionally equivalent to what you have...
    stringName = stringName.replace(/\s/g,' ');
    I highly recommend browsing this website (lots of useful info there):
    http://www.regular-expressions.info/
    Harbs

  • Replace special characters in xml to its HTML equivalent

    Hello All,
    I did a small xml processor which will parse the given xml document and retrieves the necessary values. I used XPath with DocumentBuilder to implement the same.
    The problem which had faced initially was, i could not able parse the document when the value comes with the '&' special character. For example,
    <description>a & b</description>I did some analysis and found that the '&' should be replaced with its corresponding HTML equivalent
    &amp; So the problem had solved and i was able to process the xml document as expected. I used the replaceAll() method to the entire document.
    Then i thought, there would be some other special character which may cause the same error in future. I found '<' is also will cause the same kind of error. For example,
    <description>a < b</description>Here i couldn't able to use the replaceAll(), because even the '<' in the xml element tags was replaced. So i was not able to parse the xml document.
    Did anyone face this kind of issue? Can anyone help me to get rid of this issue.
    Thanks
    kms

    Thats the thing about XML. It has to be correct, or it doesn't pass the gate. This is nothing really, seen it many times before. It becomes funny when you start to run into character set mismatches.
    In this case the XML data should have either been escaped already, or the data should have been wrapped in cdata blocks, as described here:
    http://www.w3schools.com/xml/xml_cdata.asp
    Manually "fixing" files is not what you want to be doing. The file has to be correct according to the very simple yet strict XML specifications, or it isn't accepted.

Maybe you are looking for

  • Stock on posting date in WH

    Hi All, Like MB5B is there any t.code or table to see stock on posting date in Warehouse? (like in so and so bin and in that S.type)

  • How do I add files to a local Subversion repository using JDeveloper?

    Hi Guys and Gals, Using Studio Edition Version 11.1.1.3.0. Extension "Version Support for Subversion 11.1.1.3.37.56.60". I'm getting into creating my first "real" JDeveloper program and want to implement Subversion control. I've never done anything w

  • How can you change individual words in a PDF using javascript?

    Hi, I am trying to do some simple text replacement in a PDF file using Acrobat. Specifically, I want to do some simple transliteration of words or partial transliteration. For instance, I would like to change a word like "red" to "ρed". This is to he

  • How to make text part of object

    I have a square box that I created that is black. I have a white letter placed on the box(2D by the way). I want the letter to be part of the box, not just a croup, but merge the two. On a similar note, how do I merge two objects? Thanks

  • Problem with process order resource selection condition

    I face a problem while trying to release process order as i am getting an error as "Resource XXXX assigned to operation 20 does not meet resource selection condition".What may be the reason for this.how to check and rectify... Please help.