Replacing comma with Javascript

Hi,
How to replace commas in an array with Javascript???
For eg, i have an array that contain the values 1,2,3,4.
Here i want to remove the comma. So the solution i am looking for is
1234.
How to do this. Can we the Java functions like replace() in javascript?
How to import the Java classes in Javascript???
Please do provide a solution for this.
Regards,
M.Ananthu

I'm not aware of any mechanism in Javascript that can help with this. In our fully-internationalized web applicaiton we choose to perform all locale-dependent validation server-side. This includes dates, numbers, currency values etc. About the only thing we check in Javscript is that required fields are filled in.
I'd be interested in knowing if anyone has solved this in Javscript. Its possible that you could dynamically generate a Javscript validation routine based on the locale-specific formatting symbols, but we decided it wasn't worth it.
T

Similar Messages

  • Replacing comma with space

    Hi,
    Note : I am using SAP 4.6
    Task      : Replace Comma with space
    Problem : Not able to replace comma with space
    I have task where I have to write result file to application server, when I am writing string to application server it is separating by comma, for example if you take below statement it is dividing by space that means in first column PO and then ITEM etcu2026.
    MOVE  'PO ITEM is not there in table EKPO' TO W_RECORD_OUT-ERROR_MSG.
    so to resolve this situation I have used below code for now, I know I can use
    REPLACE ... ALL ENTRIES but this statement is not working in SAP 4.6
    REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
      CONDENSE W_RECORD_OUT-ERROR_MSG.
      REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
      CONDENSE W_RECORD_OUT-ERROR_MSG.
      REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
      CONDENSE W_RECORD_OUT-ERROR_MSG.
      REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
      CONDENSE W_RECORD_OUT-ERROR_MSG.
      REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
      CONDENSE W_RECORD_OUT-ERROR_MSG.
      REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
      CONDENSE W_RECORD_OUT-ERROR_MSG.
      REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
      CONDENSE W_RECORD_OUT-ERROR_MSG.
      REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
      CONDENSE W_RECORD_OUT-ERROR_MSG.
      REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
      CONDENSE W_RECORD_OUT-ERROR_MSG.
      REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
      CONDENSE W_RECORD_OUT-ERROR_MSG.
      REPLACE ',' WITH ' ' INTO W_RECORD_OUT-ERROR_MSG.
      CONDENSE W_RECORD_OUT-ERROR_MSG.
    appreciate if somebody can help me.
    Thanks
    sarath

    Hi,
    Please check the below code.
    REPORT  YSAT_TEST.
    Data: Var1(40) type c value 'Test1,Test2,Test3,Test4'.
    break-point.
    REPLACE ',' WITH space INTO Var1.                   " It will replace only first occurrence
    replace all occurrences of ',' in var1 with '   '.
    CONDENSE Var1 no-gaps.
    write: var1.

  • Replace comma with dot

    Dear all,
    I'm getteing mad with the following issue and need your help.
    I'm working at a PDF-Form including a table. The Values in this table create a datamatrix. This works fine for now.
    Here is my issue: The values in the table are numbers like 12.2 but also 12 or 9 but maximum two digits in front of the "."(dot). Seperation character should be a "." In Germany there is the ","(comma) instead of the "." at the number block.
    For better usability it would be nice having a java script that replaces onBlur all "," with a ".". So I don't have to change the keyboard language to English.
    Is this possible and if yes, how?
    I am an absolutely noob on javascript, so please be patient and do not expect any specific knowledge.
    What I tried (menue is translatet from the German version, I don't know if it is correct:
    onBlur.replace(",", ".");
    I put this in (right click on form) -> properties ->action ->
    add action: on mouse exit
    choose action: run JavaScript
    click on "add"
    Then I copied the terminus from the top in the opening window. Ready (at least this was my thought...)
    It dit not work, now I nedd your help.
    Thank you for your hints, your help and your time.
    Adobe Acrobat XI (German) on Windows 7 64bit (also german).

    ***************SOLVED**********************
    The solution was much easier than expected:
    when you open "properties" by right clicking on the form, go to "validation" NOT "action" (make sure you are in the form editing mode: "tools" -> "forms" -> "edit")
    then chose "run user defined script" and click on "edit"
    type in the following line:
    event.value = event.value.replace(/\,/g, ".");
    click "OK" and then "Close"
    Then you are done. Now, when you leave the form field Acrobat checks if there is a comma and replaces it with a dot.
    For me this was the easiest way to make it work.
    ***************SOLVED**********************
    ***************GELÖST**********************
    Die Lösung war einfacher als gedacht.
    Öffnet man "Eigenschaften" mit einem Rechtsklick auf das Formular, muss man "Validierung" und nicht "Aktionen" auswählen. (man muss im Formulareditierungsmodus sein: "Werkzeuge" -> "Formulare" -> "Bearbeiten")
    dann unter "Benutzerdefiniertes Validierungsskript ausführen" auf "Berabeiten" klicken.
    Im Editorfenster folgende Zeile eingeben:
    event.value = event.value.replace(/\,/g, ".");
    Über "OK" und "Schließen" zurück zu den Eigenschaften
    Das war's. Nun ersetzt Acrobat im Formularfeld jedes Komma durch einen Punkt.
    ***************GELÖST**********************

  • Replace comma  with a character only if it is enclosed in single quotes

    I have a string
    String stmt = "insert into ABC values (Default,'ABC','1234,xyz,abc');{code}
    expected the result is
    insert into ABC values (Default,'ABC','1234~xyz~abc')
    I want to replace only those commas with a ~ if they are part of the string enclosed in a pair of singe quotes.
    i am trying something like
    {code}String regex = "\'\\w+(,)+\\w*,*\\w*\'+\1";
    String output = stmt.replaceAll(regex,"~");
    {code}
    but its not working
    Please help.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    LearningMachine wrote:
    No, that's not what I am trying to do.
    This is not an insert into a sql, I have to parse a DML (SQL Script) and get table name, values out of it, but I can't split the string with commas.
    Then you should find or build a parser.
    Unless the DML is very well constrained or the set is very small and will remain so, by the time you finish mucking around with all the possibilities attempting it with regexes you will have a parser but not a very good one.

  • Replace comma with nothing

    Hi all
    In a select statement I need to delete the commnas in a string that has a number with commas.
    i.e replace 1,123.10 by 1123.10

    select replace(col,',') from table

  • How replace comma with break line

    Hi, 
    Instead of John,Dee, i want it to show
    John
    Dee.
    my code isn't do what i want, can anyone help pls?
    thanks
    <cfset mystring ="John,Dee" />
    <cfset TheText = replace(mystring, ',', "#chr(10)##chr(13)#", "ALL") />
    <cfoutput>
    #TheText#
    </cfoutput>

    Yeah.  If you're gonna go ACTUAL HTML output, then forget the line break and just put each indexed value into a <p> tag (which, because it's a block-level element, will place it on each line)
    <cfset myList = 'Aegis,Kleais' />
    <cfoutput>
    <cfloop list="#myList#" index="i">
         <p>#i#</p> 
    </cfloop>
    </cfoutput>
    This should output:
    Aegis
    Kleais
    The spacing between the text can be controlled via CSS.

  • Repalce comma with Space in Webi report.

    Hi Experts,
    My address Column in Webi report is showing data is like :
    Address (this is the field coming for BW)
    House No1,Flat J10,New Delhi,INDIA.
    Can we replace Comma with the space so that the ablove data would be like :
    House No1 Flat J10 New Delhi INDIA.
    Thanks.

    Hi Abdi
    Use the formula
    = Replace("House No1,Flat J10,New Delhi,INDIA";",";" ")
    then you will get
    House No1 Flat J10 New Delhi INDIA.
    Use the object in place of Text
    =Replace([Address];",";" ")
    Regards,
    Mahi

  • Calculated formula for replacing a comma with a Semicolon in a text field

    I need help replacing a comma with a Semicolon in a text field.
    I have a field that has names separated by commas.  
    Ex: Dog, Cat, Bird, Horse, Eagle, Worm, Snake
    I would like a calculated column that converts the field into: Dog; Cat; Bird; Horse; Eagle; Worm; Snake
    I figured out the first three positions (Dog, Cat, Bird,) but I can't figure out the rest.
    Using the formula below.
    =REPLACE((REPLACE((REPLACE([Title],SEARCH(",",[Title]),"1"," ; ")),SEARCH(",",(REPLACE([Title],SEARCH(",",[Title]),"1"," ; "))),"1"," ; ")),SEARCH(",",(REPLACE((REPLACE([Title],SEARCH(",",[Title]),"1","
    ; ")),SEARCH(",",(REPLACE([Title],SEARCH(",",[Title]),"1"," ; "))),"1"," ; "))),"1"," ; ")
    Please help

    check the similar post
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/66e2ae2a-4da9-4c58-a8bb-cf46b1bf448f/calculated-column-to-replace-commas?forum=sharepointgenerallegacy

  • Replacing csv commas with tabs

    Has anyone come accross a command, preferably in vi to replace comma's seperated fields with tab delimited fields? I know about the substitution command but as people who work with csv files might know that fields of data with commas in them have quotation marks around them, I need to keep these commas in the file.

    Not sure if I understand this 100%
    But if I do, then this should work:
    `fixcsv.py inputfile outputfile`
    Things that are quoted because they contain a comma will no longer be quoted since thats no longer the delimiter (tab is). Also, you can uncomment the commented out line to have every field surrounded in quotes.
    #!/usr/bin/python
    #fixcsv.py
    import csv
    import sys
    reader = csv.reader(open(sys.argv[1], "rb"))
    writer = csv.writer(open(sys.argv[2], "wb"), delimiter='\t')
    #uncomment next line if you want everything quoted
    #writer = csv.writer(open(sys.argv[2], "wb"), delimiter='\t', quoting=csv.QUOTE_ALL)
    writer.writerows(reader)
    Be sure to backup your data just in case.
    Last edited by sabooky (2007-06-06 05:00:14)

  • Replace each third comma with ||

    Hi All,
    My Requirement is like this:
    In a column i need to replace every third comma(,) with || symbol.
    eg:
    1,Animesh,1234,2,Tripathi,4321,3,Oracle,2345.....(and so on)
    Desired output:
    1,Animesh,1234||2,Tripathi,4321||3,Oracle,2345....Please help me out.
    Regards
    Animesh
    Edited by: Animesh Tripathi on Dec 11, 2012 2:22 AM

    Animesh Tripathi wrote:
    Hi LPS,
    Sorry for duplicating the post.
    The reason i duplicated this is because, earlier i did not get any proper answer for this and I thought of replicating this
    to another community.
    AnimeshHi Animesh,
    you have posted again the same question to have again the same exact answer.
    I have answered you previously and you seemed also satisfied in this thread: {message:id=10739356}:
    Animesh Tripathi wrote:
    Hi Alberto,
    That was what i exactly wanted.
    Thanks for the Help.
    Regards
    AnimeshWhy are you saying you did not get a proper answer?
    Did you face any problem with previous solution?
    Regards.
    Al

  • Opening document in frame with javascript

    Hello.
    I've got problem with javascript on Safari 4 (both and on Win and on MacOS), while trying to open html document in frame.
    Reproducing the problem is quite difficult, so I'll begin with html source.
    I have one frame in index.html file:
    +<iframe id="topframe" name="topframe" scrolling="no" frameborder="0" width="980" height="580" src="form1.html";></iframe>+
    form1.html looks like this:
    +<input type="button" id="action" name="action" value="Make action" onclick = "document.getElementById('actionframe').src='dir/action.html';">+
    +<input type="button" id="sel" name="sell" value="..." onclick = "top.frames[['topframe']].location.replace('form2.html');">+
    action.html source is:
    +<script type="text/javascript">parent.document.getElementById('sel').click();</script>+
    So, when you open index.html, you see two buttons: first opens form2.html in the same frame, second opens dir/action.html in other frame. While dir/action.html just "clicks" the first button.
    Basically both buttons does the same.
    The problem is, that Safari fails to open form2.html with first button. Somehow Safari thinks that form2.html is in /dir/, like action.html is. So you get this error:
    *Not Found*
    *The requested URL /safari_test/dir/form2.html was not found on this server.*
    This example works on all major browsers, except Safari 4. Even on Safari 3 it works fine.
    I made an example, so you can test it here:
    http://82.135.245.49/safari_test/
    Message was edited by: Elvinas

    Have you tried putting the full URL instead of just form2.html?
    Second option is to move the file to that directory and change it for the other browsers.
    Third option is to stop using frames altogether, they are generally considered bad practice and can cause issues with browsers that aren't IE.

  • C# control event handling with javascript

    How can I get javascript to execute for "onchange" / "OnSelectedIndexChanged" event instead of a CodeBehind method? I think "OnSelectedIndexChanged" event has to be handled by CodeBehind; but how can I replace that (or onchange) with
    a javascript event handler?
    I have the following in my xyz.ascx file:
    <asp:DropDownList ID="ddlTypeCar" CssClass="BatsRefAddressTypes" runat="server"
                      onchange="javascript: testAlert();"
                      OnSelectedIndexChanged="ddlTypeCar_SelectedIndexChanged"
                      AutoPostBack="True" />
    I could not get the javascript to execute, even though I removed OnSelectedIndexChanged="ddlTypeCar_SelectedIndexChanged" and/or set AutoPostBack="false".
    Additionally, I tried added the following in xyz.ascx.cs Page_Load() method.
    ddlTypeOfAddress.Attributes.Add("onchange", "javascript: testAlert();");
    which didn't help.
    Thanks for your help in advance.

    Hi,
    you can control client events instead of server events with javascript
    look this url for more information
    http://www.w3schools.com/js/js_events.asp
    Regards

  • Invoke servlet with javascript

    Hello.
    I need to invoke a servlet with javascript when the user clicks a button.
    Is there a way to invoke the servlet without submitting the page ?
    Thanks in advance.

    onchange="location.replace('ServletName');"

  • Replace gail with extra/gtk2? [Y/n]

    Verifying before I update
    (pacman -Syu)
    What is this?:
    Replace gail with extra/gtk2? [Y/n]

    Here it is:
    [gour@gaura-nitai gour] yaourt -Syu                   
    Password:                         
    :: Synchronizing package databases...
    gaur is up to date
    core is up to date
    extra is up to date
    community is up to date
    :: Replace gail with extra/gtk2? [Y/n] y
    :: Starting full system upgrade...
    :: Replace gail with extra/gtk2? [Y/n] y
    warning: bogofilter: local (1.1.7-3) is newer than gaur (1.1.6-1)
    warning: bzrtools: local (1.7.0-1) is newer than community (0.91.0-1)
    warning: cinelerra-cv: local (1061-3) is newer than gaur (1056-2)
    warning: emacs-w3m-cvs: local (20080425-1) is newer than gaur (20080307-1)
    warning: glade: local (3.6-1) is newer than extra (3.5.2-1)
    warning: kiwi: local (1.9.23-1) is newer than community (1.9.22-1)
    warning: postgresql: ignoring package upgrade (8.3.4-1 => 8.3.4-3)
    warning: xmobar-darcs: local (20080616-1) is newer than gaur (20080416-1)
    resolving dependencies...
    looking for inter-conflicts...
    Remove (1): gail-1.22.3-1 
    Total Removed Size:   1,63 MB
    Targets (69): glib2-2.18.2-1  atk-1.24.0-1  libpng-1.2.32-1  libcups-1.3.9-1  xcb-util-0.3.0-2  cairo-1.8.0-1 
                  pango-1.22.0-1  gtk2-2.14.4-1  cairomm-1.6.4-1  libetpan-0.57-1  claws-mail-3.6.1-1 
                  claws-mail-extra-plugins-3.6.1-1  e2fsprogs-1.41.2-1  popt-1.14-1  cryptsetup-1.0.6-2 
                  cups-1.3.9-1  dhcpcd-4.0.2-1  dnsutils-9.5.0.P2-1  postgresql-libs-8.3.4-2  dovecot-1.1.4-1 
                  fam-2.7.0-11  gegl-0.0.20-1  libglade-2.6.3-1  pycairo-1.6.4-1  pygobject-2.15.4-1  pygtk-2.13.0-1 
                  gimp-devel-2.6.1-1  gimp-help-2-2.4.2-1  glibmm-2.18.0-1  gmp-4.2.4-1  gnome-doc-utils-0.14.0-1 
                  gstreamer0.10-0.10.21-1  pangomm-2.14.0-1  gtkmm-2.14.1-1  imagemagick-6.4.4.9-1 
                  kernel26-2.6.27.1-1  klibc-udev-130-1  lib32-libpng-1.2.32-1  libdvdcss-1.2.10-1 
                  libisofs-0.6.10-1  libjpeg-6b-5.1  liboil-0.3.15-1  libx11-1.1.5-2  mpfr-2.3.2-2  netcfg-2.1.2-1 
                  ntp-4.2.4p5-1  nvidia-173xx-173.14.12-2  orbit2-2.14.16-1  pm-utils-1.2.2.1-1  pygtk-docs-2.13.0-1 
                  python-gdata-1.2.2-1  qt-4.4.3-1  qscintilla-2.3-1  sdl-1.2.13-2  shadow-4.1.2.1-2  sip-4.7.7-2 
                  subversion-1.5.3-1  tcl-8.5.5-1  xvidcore-1.1.3-2  lzo2-2.02-3  transcode-1.0.6-1  udev-130-1 
                  libshout-2.2.2-2  vlc-0.9.4-2  inputproto-1.4.4-1  xextproto-7.0.3-2  xpdf-3.02_pl2-2 
                  xtrans-1.2.2-1  youtube-dl-2008.10.16-1 
    Total Download Size:    0,00 MB
    Total Installed Size:   672,14 MB
    Proceed with installation? [Y/n] y
    checking package integrity...
    (69/69) checking for file conflicts                 [#######################################################] 100%
    error: could not prepare transaction
    error: failed to commit transaction (conflicting files)
    /usr/share/gtk-doc/html/pygtk/atk-class-reference.html exists in both 'pygtk' and 'pygtk-docs'
    [snip]
    pygtk: /usr/share/gtk-doc/html/pygtk/unixprint-functions.html exists in filesystem
    Errors occurred, no packages were upgraded.
    missing dependency for libgnomecanvas : gail>=1.22.0
    Sincerely,
    Gour

  • Updating A Table With Javascript Passback

    My application concerns registration of vehicles and I have a problem.
    From the main vehicle screen, the operator clicks on an icon to choose a number plate. This icon opens a cutom popup page displaying this report.
    select REGISTRATION, 'placeholder' the_link
    FROM MER_BFG_REGISTRATION_NOS
    where ISSUED IS NULL
    and :P11_MANUFACTURED_DATE between VALID_FROM and VALID_UNTIL
    AND UPPER(REGISTRATION) LIKE '%' || UPPER(:P31_SEARCH) || '%'
    ORDER BY REGISTRATION ASC
    In the URL of my link column I have
    javascript:passBack('#REGISTRATION#');In my page header I have
    <script language="JavaScript">
       function passBack(passVal1)
       opener.document.getElementById("P16_BFG_NO").value = passVal1;
       opener.document.getElementById("P16_BFG_NO_SHOW").value = passVal1;
       opener.document.getElementById("P16_BFG_NO").focus();
       close();
    </script>.
    My problem is that when the user clicks on the link for a particular registration, a flag should be set against this registration, so it cannot be chosen by another user in another session.
    Once they have returned to the main page I can undo this flag, after the record has been saved and replace it with an issued_date.
    Has anybody got an ideas how to achieve this
    Gus

    Hi Gus,
    what you want to do is calling an Application Process from JavaScript (AJAX) using "htmldb_get". In the Application Process you can then set the flag (PL/SQL).
    This is the native APEX solution, you could also wait a couple of days until i release ApexLib 2.1 which will support AJAX Page Processes.
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    Work: http://www.click-click.at

Maybe you are looking for

  • Airport Ext. Port Forwarding does not work

    I am trying to open up UDP ports 500, 1701, and 4500 to point to my local computer since i'm using iVPN. However, Airport doesn't seem to want to open these up. I disabled Mobile Me as per the support document I found and still having issues. I want

  • Wrong picture in AFRU table for scrap...

    Hi Experts, When I confirming co11 and entering scrap, it show wrong picture in AFRU table. e.g. : For first time i entered 2 scrap.         Seconf time i entered  1 scrap. But in table it shows 5 scrap. Which is the right table ? How to finf scrap q

  • Error when Starting LiveCache

    Hello all, The restart of LiveCache is works fine, but I checked the LCTRC#init.log file and I saw the following error: Installation successfully finished ================================== 11455 2009-01-13 16:21:03.000 ERROR: Could not write to 'teo

  • Request a GOP UEFI bios for MSI R9 270 Gaming 2g

    MSI R9 270 Gaming 2g sn:602-v305-010b1402051637 Bios Version: 015.041.000.000.003038(113-C6300100-X01) Original vbios: speedy.sh/mD8uN/Pitcairn.rom Thank you very much.

  • Access 2003 to oracle 9i Migration(Oracle Migration Workbench)

    Hi Experts, I have taken up a project to migrate Access 2003 application to Oracle 9i.The Forms and Reports will continue to run in Access 2003 with Oracle 9i database. I decide to use Oracle Migration workbench for the migration purpose.What I think