How to compare two currency form fields and display a message if the fields do not equal?

My form has 2 fields named Total_1 and Total_2. If one of the fields does not equal the other, a hidden field will display a message in red on the form alerting the user. Otherwise, the message does not display. Looks like a validation script but I would greatly appreciate help in getting it started. Any ideas?
Thanks, Charlie
charlie6067

Since the field values that you want to compare are the results of calculations, you should not normally compare their string values, but rather their numeric values when rounded appropriately (and perhaps then converted to a string). For example, if you have two values that display as 3.14, one could be 3.1400000001 and the other could be 3.13999999999991234. When you get the field values as strings and compare them, they won't be equal though they appear to be. Even some values that are numerically identical won't be equal when compared as strings ("0.0" != "0.00") So the code could be changed to:
// Get the two field values, rounded to two decimals
var v1 = util.printf("%.2f", getField("Total_1").value);
var v2 = util.printf("%.2f", getField("Total_2").value);
// Hide/Show the error message
event.value = (v1 === v2 || (+v1 === 0 && +v2 === 0)) ? "" : "Error message here.";

Similar Messages

  • Trying to make a dvd from a project and this error message appears .The project could not be prepared for publishing because an error occurred. (-2125)

    Trying to make a dvd from a project and this error message appears .The project could not be prepared for publishing because an error occurred. (-2125)

    Hi
    Error -2125
    OK Error code - 2125 usually indicates that the movie is to large.
    It use to pop up when going to iDVD !
    iDVD - DO NOT CARE ABOUT Gbs at all. I got movies on 500Mb that do not fit and 50Gb that fits nicely.
    iDVD - ONLY CARES ABOUT - Duration. Duration is Movie time + MENU TIME. Choice of
    menu and animation of this can take lost of "DURATION" 15 minutes or even more.
    Choice of encoding method and use of SL or DL DVDs determine the DVD limit.
    iDVD 08 & 09 & 11 has three levels of qualities.
    iDVD 6 has the two last ones
    • Professional Quality (movies + menus up to 120 min.) - BEST
    • Best Performances (movies + menus less than 60 min.) - High quality on final DVD
    • High Quality (in iDVD08 or 09) / Best Quality (in iDVD6) (movies + menus up to 120 min.) - slightly lower quality than above
    DL DVDs can store about double of these times.
    ALTERNATIVE - The Error Code can indicate that free space on Start-up (BOOT) hard disk is
    less than 25Gb (my minimum)
    calbe - wrote
    If you are getting OSStatus error -2125, I've seen this caused by the computer display sleep settings.
    Try changing the sleep settings to never and see if you are able to export.
    Yours Bengt W

  • How can I attach a jpg file in a mail message as the file icon, not as an opened image in the text?

    How can I attach a jpg file in a mail message as the file icon, not as an opened image in the text?

    what's wrong with this picture

  • How to stop a process from running and display a message

    I have a button that inserts data into a table based on bind variable selected on the page. I would like to add code to that button that will check to see if certain data already exists in the table, for that bind variable, and if that data already exists, stop the process and display a message that says "you have already inserted that information - bla bla bla". If not, continue inserting. What would be the best way to do this?
    Currently, the button is a plsql that inserts the data.
    Any help or examples would be greatly appreciated!
    mholman
    Edited by: user10488561 on Jul 27, 2009 8:48 AM

    Use a validation process for that. If the validation fails (data exists) the processes will not be run. If it doesn't then the processing will continue.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    ------------------------------------------------------------------------------

  • I opened a new document and a popup messages says; "The document could not be autosaved."  Pages won't allow me to manually save or duplicate document.  What's up?

    I opened a new document in Pages 5.2 and a Pop up message appears; "the document could not be autosaved."  First time I have seen this.  Went to manually save the docement and another message appears; "the document "Untitled" could not be saved as "Project Portfolio" [my document title].  Then, Pages would not let me duplicate the document.
    I suspect something may be missing and I need to reload Pages.  Is there another way?
    Thanks

    What is your current Flash Player version: http://helpx.adobe.com/flash-player/kb/installation-problems-flash-player-windows.html ?
    What is your display adapter, driver version & date?  See http://forums.adobe.com/thread/945765

  • How To : Call External Webservice from BPEL and pass SOAP Message to the WS

    Hello All-
    Greetings to all BPEL gurus. I am currently facing difficulties in calling an External Webservice from my BPEL Process and passing SOAP Message to it. The details are below:
    <strong>1. The BPEL process, using database polling feature of DB Adapter, will get the records from the database.</strong>
    <strong>2. Transform the message</strong>
    <strong>3. Call the External Webservice and pass the transformed message as the input to it. However the Webservice expects the BPEL process to send SOAP headers in the input message.</strong>
    I am struggling on how to put the transformed message within a SOAP envelope in the BPEL process.
    If anyone had similar requirements and have successfully been able to send SOAP messages from BPEL process to an external webservice, kindly let me know.
    Also if there is some kind of documentation or any link in the forum that I can refer, please let me know that as well.
    I am new to Webservice integration using BPEL and would really appreciate your help.
    Thanks In Advance
    Regards,
    Dibya

    Hi Dharmendra,
    I am trying to send a SOAP message from my BPEL process to a web service. I have a complete SOAP message in a complex variable defined in the wsdl for the partnerlink (web service). My problem is that when I invoke the partnerlink it fails even though the content shown in the BPEL console looks valid.
    I have set up obtunnel to see what I am actually sending out from BPEL. You mention that BPEL creates the SOAP envelope automatically.
    I think that my problem is a result of this automatic SOAP envelope that BPEL is creating. Do you know if there is a way to turn it off?
    This is what I see in the TCP monitor, please note the double SOAP env:Body:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <RCMR_IN000002NR01 xmlns="urn:hl7-org:v3" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <env:Header>
    <wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">http://testhost/CCS/Service_Endpoint</wsa:To>
    <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
    <wsa:Address>http://localhost/CCS/Service_Endpoint</wsa:Address>
    <wsa:Metadata>
    <device xmlns:hl7="urn:hl7-org:v3">
    </device>
    </wsa:Metadata>
    </env:Header>
    <env:Body>
    <RCMR_IN000002NR01>
    </RCMR_IN000002NR01>
    </env:Body>
    </RCMR_IN000002NR01>
    </env:Body>
    </env:Envelope>
    Any help is appreciated.
    Regards,
    Aagaard
    Edited by: Aagaard on Oct 30, 2008 8:59 PM
    Should have mentioned. I am using BPEL 10.1.3.4
    Edited by: Aagaard on Oct 31, 2008 8:43 AM
    I have opened a new thread for this question so as to not confuse the issue more than necessary.
    How many SOAP envelopes do you really need?

  • How do i stop mail from synchronising and downloading old messages on the google mail server

    its downloading over 300 000 messages up until 2004! and whenever i go online from mail on the mac it starts the process all over again. are there settings anywhere from where i can stop this

    Try rebuilding the mailbox. This can take awhile if you have a lot of mail.
    Rebuild mailbox
    If that doesn't work, try re-indexing the mailboxes. This can take awhile if you have a lot of mail.
    Reindex messages      Mavericks/Yosemite

  • How do I publish a movie on iMovie when this message appears:"The project could not be prepared for publishing because an error occurred. (Error in user parameter list)"?

    When I go to finalize my movie on iMovie or attempt to publish it, this message appears. 

    Hi
    Error -2125
    OK Error code - 2125 usually indicates that the movie is to large.
    It use to pop up when going to iDVD !
    iDVD - DO NOT CARE ABOUT Gbs at all. I got movies on 500Mb that do not fit and 50Gb that fits nicely.
    iDVD - ONLY CARES ABOUT - Duration. Duration is Movie time + MENU TIME. Choice of
    menu and animation of this can take lost of "DURATION" 15 minutes or even more.
    Choice of encoding method and use of SL or DL DVDs determine the DVD limit.
    iDVD 08 & 09 & 11 has three levels of qualities.
    iDVD 6 has the two last ones
    • Professional Quality (movies + menus up to 120 min.) - BEST
    • Best Performances (movies + menus less than 60 min.) - High quality on final DVD
    • High Quality (in iDVD08 or 09) / Best Quality (in iDVD6) (movies + menus up to 120 min.) - slightly lower quality than above
    DL DVDs can store about double of these times.
    ALTERNATIVE - The Error Code can indicate that free space on Start-up (BOOT) hard disk is
    less than 25Gb (my minimum)
    calbe - wrote
    If you are getting OSStatus error -2125, I've seen this caused by the computer display sleep settings.
    Try changing the sleep settings to never and see if you are able to export.
    Yours Bengt W

  • How to compare two strings whether both are equal while ignoring the difference in special characters (example: & vs & and many others)?

    I attempted to compare two strings whether they are equal or not. They should return true if both are equal.
    One string is based on Taxonomy's Term (i.e. Term.Name) whereas other string is based on String object.
    The problem is that both strings which seem equal return false instead of true. Both string values have different special characters though their special characters are & and &
    Snapshot of different design & same symbols:
    Is it due to different culture or language?
    How to compare two strings whether both are equal while ignoring the difference in special characters (& vs &)?

    Hi Jerioon,
    If you have a list of possible ambiguous characters the job is going to be easy and if (& vs &) are the only charracters in concern awesome.
    You can use the below solution.
    Before comparing pass the variables through a replace function to standarize the char set.
    $Var = Replace($Var,"&","&")
    This is going to make sure you don't end up with ambiguous characters failing the comparison and all the char are "&" in this case.
    Similar technique is used to ignore Character Cases 'a' vs. 'A'
    Regards,
    Satyajit
    Please “Vote As Helpful”
    if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

  • How to Compare two Dates in java

    How to Compare two Date Field after getting the values from jTextField1.getText() and jTextField2.getText().

    Date d1=DateFormat.getDateInstance().parse(yourstring1);
    same for d2
    d1.compareTo(d2);
    could be that i misrememberd the exact naems of some functions or mixed up something in the equence of d1=

  • How to compare two Objects !!!!

    Hi All,
    I know that this question has been asked 100 times till now. But trust me I have checked all of them but couldn`t find answer. Here is my question:
    I have an objecs. In that object I am setting (Id,Name,DOJ). Now I want to check whether the object I am trying to save in database already exists or not. If exists then I need to check whether all the setters are same for the two objects. Now can anyone tell me ,how to compare two objects directly without comparing the setters individually.
    Thanks in advance.

    pavan13 wrote:
    That is pretty good idea. However I have a query. Does that code actually compare all the setters in a two beans. I don`t want to check each setter seperately.Well, it's pretty meaningless to talk about "comparing setters", setters are methods, they don't have values to compare. Because equals is inside the class, you can simply compare the fields that get set by the setters. "Properties" is probably a better name.
    In principal you could write something that tried to find all relevant fields and compare them, using reflection or bean info stuff. The resulting code would be about 50 times longer and take about 50 times longer to run. It's hardly asking a lot to put three comparisons between && operators.
    Remember, though, not to compare string fields with ==, you should call .equals on the string fields.
    p.s. don't let the bean terminology confuse you. Beans are just ordinary objects which follow a few rules. Personally I wish the term had never been coined.
    Edited by: malcolmmc on Dec 6, 2007 4:15 PM

  • How to compare two different environments

    Can any please tell me how to compare two environments like DEVL to TEST?
    I know how to compare a project(like DEVL to TEST) but i want to see all the changes in all the objects between two different environments.
    Please help me.
    Thank you.

    That is really a good piece of information.
    Does it really matter where we are comparing from?
    i will explain,let us say we have DEV and TST environment.
    let us say both has same project name and the same number of objects but inside the object they may be different(like number of fields in the same record in both environments).
    Now we want to have a compare report between those environments.
    We can do in two different ways, right?
    (1. source DEV, Target TST)
    (2. source TST, Target DEV)
    will the result get changed in both the cases?
    (except like following)
    (first case souce target)
    ( absent *changed)
    (second case would be like following)
    ( souce target)
    ( *changed  absent)
    (but i gess the number of rows in both the cases does not get changed)
    let me know if you can not understand the question. sorry about the confusing explanation

  • How to compare two IDocs

    Hi all,
          How to compare two IDoc's. If the both the IDocs are are of same type, i want to distinguish the data in those two IDocs.
    Thank you in Advance
    Regards
    Harsha

    Hi Harsha,
    Transaction WE05 will help you out.You should first know some details like the
    iDoc type, partner, the date/time and maybe the iDoc #. There can be many iDocs
    generated/processed per day and without having some info to start with,
    one will never find anything useful. Filter what you can, and then
    navigate in the left hand frame/double click on the results lines in the
    right hand frame to drill down. Eventually you will see the single iDoc
    with all the many 'segments' available. Expand the 'data records'
    branch (and sub-branches) to see each 'segment' and find the data fields
    & values (these will appear in the lower right hand frame).
    Reward points if helpful..
    Regards,
    Goutham.

  • How to compare two Universes of two different Datamarts?

    Post Author: Shrikant
    CA Forum: Integrated Solutions
    Hi.. all I want to compare two universes of different data mart to check the table structure. Can anybody please tell me how to compare two Universes of different Datamarts?How i can achive this usinig BusinessObjects Enterprise XI Release 2 ??
    Thanks in advance.

    /*does record 1 have friend*/
    WITH t AS
    (SELECT 1 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 2 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 3 AS Id, 'a' AS NAME, 'type2' AS Col FROM Dual)
    SELECT count(*) as YesNo
    FROM t T1
    WHERE T1.Id = 1
          AND (T1.Name, T1.Col) IN (SELECT T2.Name, T2.Col FROM T t2 where t2.ID != T1.Id);
         1
    /*does record 3 have friend*/
    WITH t AS
    (SELECT 1 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 2 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 3 AS Id, 'a' AS NAME, 'type2' AS Col FROM Dual)
    SELECT count(*) as YesNo
    FROM t T1
    WHERE T1.Id = 3
       AND (T1.Name, T1.Col) IN (SELECT T2.Name, T2.Col FROM T t2 where t2.ID != T1.Id);
         0
    */

  • How to compare two wage types?

    What is the best way to compare two wage types?
    For example, if I see the wage type attribute screen, I need to select M010 and M110 , one by one and
    compare visually only the wt attributes. It doesn't show the processing classes etc.
    Is there a report or tool to compare and list everything about two wage types?
    Thanks,

    Thanks Arun.
    RPDLGA40 is NOT doing what I was asking. But helps a lot to learn about a given wage type.
    RPDLGA20 has many uer interactions and I am yet to learn how to understand them
    Thanks,

Maybe you are looking for

  • Multiple copies of same emails?  Help!

    Hi all - I am getting about 50 copies of each email coming in - I have almost 400,000 emails in my inbox now - cant delete them or anything.  I deleted and then added the account again and no help there.  Any ideas?  Provider says everything looks OK

  • Mouse not working when reinstalling OS X with install disk

    I am trying to reinstall OS X 10.3 on iMAC G5 after a hard drive crash with the help of the original install disks, but my wireless mouse does not work anymore. Any ideas how I can solve this or go through the installation process with the keyboard a

  • File Download Open/Save Dialog

    I'm trying to enhance an existing Flex 2 application. The application communicates with a web application via HTTPService. The Flex application can upload files from the user's local hard drive to the web application where they are ultimately stored

  • NeverCompressed list vs. CM issues on pdf or images

    Symptom: *.pdf & images causing errors on e.g. opening in CM, esp. on J2EE versions below SPS15. This might happen occasionally or always. Technical cause: Compression by J2EE In J2EE default delivery 'image' & *.pdf is always on NeverCompressed key

  • Volume Logic Removal on Itunes

    Hello everyone this is my first post to the forum so hopefully this is in the right spot. Okay so here's my problem. I downloaded volume logic a while back and it worked great for quite a while but now when I open my itunes the "Volume Logic Extended