Javascript alert script needed when calculation does not equal 100

I have created a fillable form and have a total box which I've set to calulate the sum of Field1, Field2, Field3 and Field4
which works well.
I would like to add a javascript alert if the total amount does not add to exactly 100 to stop the user submitting the form or moving to next question.
Any help would be greatly appreciated
Thank you

Hi try67,
I have implemented successfully the following:
event.value = ''; // clear field
// get the values of field 1 and 2 as string
var sField1 = this.getField("field 1").value.toString();
var sField2 = this.getField("field 2").value.toString();
// adjust for a field being 100 and the other is null
if (sField1 == 100 & sField2 == '') sField2 = "0";
if (sField2 == 100 & sField1 == '') sField1 = "0";
// do only if field 1 and 2 are not null
if(sField1 != '' & sField2 != '') {
event.value = Number(sField1) + Number(sField2);
if (event.value != 100) app.alert("Fields 1 and 2 must sum to 100!", 1, 0);
} // end not empty
Just wondered if you can let me know what I need to add to stop the form being submitted(email submit button) if the amount is not 100?
So the same alert appears ("Fields 1 and 2 must sum to 100!")
Currently if the fields exceed or are below 100, then the alert message  ("Fields 1 and 2 must sum to 100!")
appears once and you can still tab to next field, or click on next field or submit the pdf.
I was hoping to add validation on submitto be similar to required fields where you are alerted if not filled in and cannot submit until you imputted the correct calculation sum up to 100?

Similar Messages

  • Showing Booking amount when it does not equal Opportuity Revenue Total

    I there a way to create a report to easily show where the booking amount of an opportunity does not equal the sum of the products in the product revenue section? I tried Sum(Product revenue), can't quite remeber the field name, but that did not work
    Also, we would like to see any opportunity that has no predict revenue associated with it, either in the same report or a different report.
    Thanks

    David,
    The Opportunity-Product subject areas contain both Opportunity Revenue fields and Opportunit-Product Revenue fields. The Opportunity-Product Revenue field located in Columns/Opportunity-Product/Revenue/Revenue will aggregate the total amount of all products for the opportunity. There is no need to SUM this field.
    Build a report and filter it based on a field that calculates the difference between the two revenue columns and you should get your desired list of opportunities.
    Now that you know where the right fields are, you other report should be a simple filter on the appropriate revenue field = 0
    Mike

  • Warning Message only if 1 to 3 fields do not equal 100%

    I have 3 potential fields that will be completed.  If Field1 (Primary Beneficiary) is 100%, then the user will leave Fields 2 and 3 empty.  If Fields 1 and 2 equal 100%, then Field 3 will be empty.  Otherwise they will have values in Fields 1, 2, and 3.  Regardless, they should not be able to continue completing the rest of the form until the sum of these three fields equal 100%.  Therefore I did modify the form as follows, but two issues: it throws the error message up even when first entering a value in Field 1.  This script need NOT run until all 3 fields have been tabbed through, or they click on the next section of the form to continue completing.  The "Total 100" (name of this particular field) is in the Tab Order to appear after "Beneficiary 3 Benefit Percent" field.  And secondly, it still permits the user to continue rather than returning to Field1 even if the total does not equal 100%.  Your assistance is greatly appreciated!  PS:  How do I mark that the post was either helpful or correct?
    Rita
    event.value = ''; // clear field
    // get the values of Beneficiary Benefit fields 1, 2 and 3 as string
    var sField1 = this.getField("Beneficiary 1 Benefit Percent").value.toString();
    var sField2 = this.getField("Beneficiary 2 Benefit Percent").value.toString();
    var sField3 = this.getField("Beneficiary 3 Benefit Percent").value.toString();
    // adjust for a field being 100 and others null
    if (sField1 == 100 & sField2 == '' & sField3 == '') sField2 = "0" , sField3 = "0";
    if (sField2 == 100 & sField1 == '' & sField3 == '') sField3 = "0" , sField1 = "0";
    // do only if Beneficiary Benefit fields 1, 2 and 3 are not null
    if(sField1 != '' & sField2 != '' & sField3 != '') {
    event.value = Number(sField1) + Number(sField2)+ Number(sField3);
    if (event.value != 100) app.alert("The sum of Benefit percent must equal 100.", 1, 0);
    this.getField("field 1").setFocus();

    Two problems just from a first glance at this line:
    if (sField1 == 100 & sField2 == '' & sField3 == '') sField2 = "0" , sField3 = "0";
    1. You're comparing a string to a number
    2. You're separating commands with a comma and not placing {} around the block of commands.
    It needs to be something like this:
    if (sField1 == "100" & sField2 == "" & sField3 == "") {sField2 = "0"; sField3 = "0";}
    There are probably more errors, but start by fixing those.
    Also, you should probably post which error message you're getting.

  • Sender File adpter --don't raise alerts when file does not exist in folder

    Hi,
    My Scenario is File --- >XI ---> SAP.
    I must archieve the file after it got polled. and iam polling for every 60 mins, if the file does not exist,it is throwing an alert like "Could not process file '.file..xml: No such file or directory '
    Is there any way i can avoid raising an alert if file does not exist in the source folder.
    we are on XI 3.0 sp23?
    Thanks
    Srini

    Hello,
    Your Subject:
    >Sender File adpter --don't raise alerts when file does not exist in folder
    is contradictory to your question.
    >if the file does not exist,it is throwing an alert like "Could not process file '.file..xml: No such file or directory '
    > Is there any way i can avoid raising an alert if file does not exist in the source folder.
    I know you want to say "Don't Raise alerts when file does not exist in folder". Correct me if I am wrong.
    Some times it happens, when we write the right thing but it means something else and this is the reason many experts have replied, "how to raise an alert". So if you remove the word "Sender File adapter" from your subject then it will be easy to understand the exact meaning.
    Regards,
    Sarvesh

  • Quota deduction when EE has been inactive for more than 180 days / Advance quota days when employee does not have enough balance

    Dear experts,
    We have two requirements regarding to the "Anual leave" quota.
    1. Quota reduction when employee is inactive for more than 180 days
    2. Advance quota days when employeee does not have enough balance
    We have in place an "Anual Leave" quota related to a calendar year period, that gets generated dialy in time evaluation. This quota gets the employee entitlement from a set of rules that stored the corresponding balance in a period time type, that is the one that we defined in the customizing. This is working fine. The problems start when we try to incorporate the other two requirements.
    Regarding the first requirement, if the employee has been inactive for more than 180 days in a calendar year due to unpaid leave, we need to start quota reduction as follow,
    First, we need to clear the balance that was calculated above in the schema.
    Then, we need to calculate one leave day for every 20 days worked till the end of the year, considering as such, everyday the employee is expected to work, except days on which the employee has been absent on unpaid leave.
    For the second requirement we created a manual quota call "Advance Anual Leave". So, if the employee, wishes to take 20 working days holiday, but in his/her Anual Leave quota has only 10 days available, we have to create an "Advance Anual Leave" quota manualy for 10 days. When the quota for next year gets generated, we need to deduct these advanced 10 days from it. This deduction should stop the year after.
    The problem we are finding with these two requirements is that, due to the Anual Leave quota gets generated dialy, we can't get the balance right.
    Thanks in advance!
    Kind regards,
    Alex

    Hello binbingogoABC,
    Shopping on BestBuy.com should be easy and fun and not fraught with the kind of trouble that you describe. I regret very much that this has been your experience.
    Using the information you provided when you signed up for Best Buy Unboxed I was able to locate your cancelled orders. I have requested more information from my back-office partners. As soon as I have additional details about your situation, I will reply again to this message. In the interim, I'm sorry that I must impose upon your patience.
    I'm very grateful that you wrote to us with your concerns.
    Sincerely,

  • How do I get twitter installed on my iPad when it does not have iOS 5.0?

    How do I get twitter installed on my iPad when it does not have iOS 5.0? How can I upgrade my iPad?

    If you have an iPad 1, the max iOS is 5.1.1. For newer iPads, the current iOS is 6.1. The Settings>General>Software Update only appears if you have iOS 5.0 or higher currently installed.
    iOS 4: Updating your device to iOS 5 or Later
    http://support.apple.com/kb/HT4972
    How to install iOS 6
    http://www.macworld.com/article/2010061/hands-on-with-ios-6-installation.html
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623
    If you are currently running an iOS lower than 5.0, connect the iPad to the computer, open iTunes. Then select the iPad under the Devices heading on the left, click on the Summary tab and then click on Check for Update.
    Tip - If connected to your computer, you may need to disable your firewall and anitvirus software temporarily.  Then download and install the iOS update. Be sure and backup your iPad before the iOS update. After you update an iPad (except iPad 1) to iOS 6.x, the next update can be installed via wifi (i.e., not connected to your computer).
     Cheers, Tom

  • Tax does not equal 0 when tax rate is Zero

    Hi,
    We have a problem when posting an invoice through MIRO. The end user gets the message 'Tax does not equal 0 when tax rate is Zero'. I checked the tax code and it looks fine.
    Can anyone throw some light on the error?
    We are using vertex for tax calculations.
    Regards,

    Hi Raj,
    Please chek OSS NOTE 681538 .
    Check for the applicable releases and support packages from the note.
    Check from your system on what support package you are into. Goto System -> Status -> click on the magnifying glass against Component version and see what is the support pack for SAP_APPL.
    You can ask your Basis colleagues also to check if it can be applied into the system. I guess they would check it through t-code SNOTE.
    Regards
    Surya

  • Why am I told to turn off airplay on my iPad (3rd generation) when it does not even HAVE airplay according to iOS7 specs?

    Why am I told to turn off airplay on my iPad (3rd generation) when it does not even HAVE airplay according to iOS7 specs?

    I have the same problem with my device specially with the NFL App and after maybe 2hrs of research I found out that Verizon has implemented that messege/restriction to keep the app "TRUE" mobile only. What I'm saying is that you won't get the NFL App to play no matter what you do if connected to HDMI adapter or AirPlay. I hope this helps more than the other/previous post. If you need re-assurance please click on the link where I found my information, below.
    http://www.sbnation.com/nfl/2013/6/4/4394986/verizon-nfl-extension-stream-games
    v/r,
    Rigo

  • Signature does not match. The request signature we calculated does not match the signature you provided.

    re: ipad printing from safari
    I have routinely transferred pdf files to Safari and printed them from there. I now get the following message: “Signature does not match. The request signature we calculated does not match the signature you provided.”  The only change that I have made since the last thing I printed is to install the ios update.

    Hello,
    There is a possibility that you have activate line item display for some of the accounts at a later stage. Meaning that earlier postings were not be shown for the earlier postings but only totals will be made available. Therefore, obviously there is bound to be difference between line item report and totals report.
    You need to identify which accounts are being changed with line item display at a later stage.
    In case if you forget to keep GL Line item display for an account, but the posting are already made the following steps you would required to get the line item display retrospectively.
    1. Note that you are NOT required to make the balance of that GL account to ZERO. Please do not confuse with Open Item Management.
    2. Put the check box line item display for the account in FS00. Make sure you are entering right company code.
    3. Block the account for posting in COA Segment and Company Code Segment in FS00
    4. Go to SA38 and run program RFSEPA01 (Give correct GL Account and Company Code)
    5. Now, remove the block you kept on the GL Account in FS00.
    This will reset the line item display retrospectively.
    Hope this will solve your problem.
    Regards,
    Ravi

  • Asking the Bridge Team:  Bridge "working color space" setting when one does not have the Suite?

    Common sense tells me there is really no such thing as a
    "working color space" in Bridge, because
    Bridge is not an image editor, just a browser
    Therefore, this may turn out to be a purely academic question; but that doesn't keep my curiosity from forcing me to ask it anyway. ;)
    Is there a way to set the Bridge
    "color settings" when one does not have the suite?
    The only Adobe program I keep up to date is Photoshop, so I've never had the suite. My version of Photoshop is 11 (CS4) and I run updated
    (not upgraded) versions of Adobe Acrobat 7.x, Illustrator 10.x and InDesign 2.x. Consequently, the Synchronize color settings command is not available to me.
    It seems to me that Bridge is behaving like a proper color-managed browser (e.g. Firefox with color management enabled), in that it displays tagged image files correctly and assumes sRGB for untagged image files. This normally works fine.
    But what if I wanted Bridge to assume my
    Photoshop color working space for untagged images
    so that it behaves the same as Photoshop? I'm just curious, as I deal with a minuscule, practically negligible amount of untagged files.
    My reason for bringing it up now is that I don't recall this being explicitly mentioned in forum replies when users inquire about color settings in Bridge. A recent post regarding Version Cue in the Photoshop Macintosh forum got me thinking about this. Just wanting to make sure that I'm right in my assumption that
    there is really no such thing as a
    "working color space" in Bridge, because Bridge is not an image editor, just a browser.
    Thanks in advance.

    Hi Ramón,
    Thanks for sharing the outcome of your tests. However, I may have found a bug/exception to Bridge's colour management policy!
    It appears that CMYK EPS photoshop files are not colour managed in Adobe Bridge, even if they contain an embedded ICC profile.
    I've tried every combination in the EPS 'Save As' dialogue box, so it doesn't seem to be an issue with file encoding. Also, Bridge doesn't rely on the low-res preview that is held within the EPS itself.
    My guess is that Bridge is previewing the CMYK EPS with a Bridge-generated RGB image, but it's being displayed as monitor RGB (assigned) rather than colour managed (converted to monitor RGB). For most users the difference will be barely perceptible, but the problem became very noticeable when using Bridge to preview Newsprint CMYK images on a wide-gamut monitor (images that should have appeared muted really leapt off the screen!).
    How do I report this to the Colour Police at Adobe?!?

  • How to avoid output file and error lines when condition does not match

    Hi Experts
    A customer want to send purchase order files to several vendors and each vendor has their own requirement to content and file format. I have prepared scenarios for each vendor and a template is (conditionally) called when CardCode matches. It works fine, - PO file is generated when CardCode matches, but error lines are written to SAP B1 Control Center each time CardCode does not match the one defined in a scenario (100 or more times per day). Problem is that these error lines does not get automatic deleted. Conditional processing are made in this way:
    Result Message in SAP B1 Control Center when CardCode does not match:
    I tried to avoid an error line in SAP B1 Control Center when CardCode does not match in this way:
    Then no error lines are written to SAP B1 Control Center, but an output file is generated each time (order file when CardCode matches and an empty file when CardCode does not match).
    Any suggestions on how to avoid both errors types (error lines in SAP B1 Control Center and empty output files)?
    Or - can lines in SAP B1 Control Center be automatic deleted?
    Regards
    Steen

    Hi Steen,
    using <b1im_skip> should be the right approach, if you're working with B1 OUTBOUND.
    Following extract form the B1i help describes the usage to skip the outbound processing:
    1.1 Skipping Outbound Processing
    If you do not want to hand over the message to the receiver system, the scenario step can create a special tag that indicates to generic processing in the integration framework to skip the message processing.
    Add the following to the final transformation atom (atom0):
    <b1im_skip xmlns= ”” info=”my info” msglog=”true” msgout="yes">
    If the integration framework skips the message, it puts the message log information to the Filtered section, if the message log is switched on. The result message contains the Message skipped by vBIU logic information.
    info
    To display an individual message, define it using the info attribute.
    msglog
    If you want to avoid an entry in the message log, introduce the msglog attribute and set it to false.
    msgout
    To display the skip information in the Success section of the message log, use the msgout attribute and set it to yes.
    In case you don't want any MsgLogEntry in case of a skipped message, please enter the following in final atom0:
    <xsl:template name="transform">
    <xsl:attribute name="pltype">xml</xsl:attribute>
    <xsl:choose>
    <xsl:when test="$msg/BOM/BO/Documents/row/CardCode=&apos;C20000&apos;">
    <xsl:call-template name="transform2"/>
    </xsl:when>
    <xsl:otherwise>
    <b1im_skip info="skipped" msglog="false"/>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    Best regards
    Bastian

  • How do I add an app to my location services when it does not come up automatically, How do I add an app to my location services when it does not come up automatically

    How do I add an app to location services when it does not appear automatically

    Have you tried Settings>Privacy>Location Services and see if you can turn it on in there?
    Obviously it has to be an app that works with location services so if it is and nothing else works, delete the app and download it again to make it ask again if you want to allow your location to be used with it.

  • When autofill does not work

    When autofill does not work, what can the culprits be?
    Deleting preference did not work. thanks.
    Safaari 3.1.1.

    Did you ever get your problem solved?
    if so, please tell me since I have (since about a week) same problem.

  • How do I uninstall CS2 on a PC when it does not appear in control panel add or remove programs, the hard drive was replaced and the program corrupted.

    how do I uninstall CS2 on a PC when it does not appear in control panel add or remove programs, the hard drive was replaced and the program corrupted.

    reinstall over your current installation and then uninstall, Error: Activation Server Unavailable | CS2, Acrobat 7, Audition 3
    or uninstall manually, Manually remove Adobe Creative Suite 2.x | Windows

  • TS1389 When I go to play a movie, I get prompted that the original file cannot be found.  When I do a search on spotlight it cannot be found, but it does appear in my purchases.  How do I re-download when it does not appear that it is allowed?

    When I go to play a movie, I get prompted that the original file cannot be found.  When I do a search on spotlight it cannot be found, but it does appear in my purchases.  How do I re-download when it does not appear that it is allowed?

    Hello paddyrb154,
    Thank you for the details of the issue you are experiencing with your purchased movie in iTunes on your iMac.  It sounds like iTunes thinks the movie is on your computer, but it is not located in the iTunes Media folder. 
    For an issue like this, I recommend deleting the movie from iTunes and downloading it from the iTunes Store again.  Use these steps to delete the movie:
    Mac or PC
    Launch iTunes.
    From the Library pop-up menu, choose Movies.
    Click Movies in the navigation bar.
    Click the movie you want to delete.
    Press the Delete key on your keyboard.
    In iTunes 11, the movie cover art will remain visible, but a cloud icon will appear on it to allow you to download the item again (in countries that support this).
    How to delete content you've downloaded from the iTunes Store, App Store, iBooks Store, or Mac App Store
    http://support.apple.com/kb/HT5772
    Once you have deleted the movie, you can click on the cloud icon to download the movie again.  If you do not see the cloud icon, use the steps in the section titled “Download previous purchases on Mac or PC ” in the following article to download the movie from your list of past purchases in the iTunes Store:
    Download past purchases
    http://support.apple.com/kb/ht2519
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

Maybe you are looking for

  • Internal Kernel Error

    Post Ehp7 upgrade we are facing issue when executing any db related tcodes. Eg: When executing DB02 we are getting the below error message and the workprocess are getting restarted. XXX: SAP System Message: Work process restarted; session terminated

  • Eject DVD from apple tv

    How do I eject a DVD from apple tv?

  • PI 2.0 - How to run a report on Clients for an SSID

    I'm trying to run a report to find out the client count and information (MAC, Username, etc..) per SSID in a set location over a set period of time. Example: SSID: IPVOICE Location: Main Office, All Floors Time Period: Last 2 weeks I want Client MAC,

  • How to authorize computer for music

    I just got the newest MacBook Air, and I love it! However, in order to download my music onto it from my iPhone, iTunes is saying I must authorize my computer - does anyone know how to do this? Also, does it require a subscription to iTunes Match? Th

  • T43 (2668-8AG) resume problem

    Hi in forum. First sorry my poor english.  I have a t43 notebook with a problem: - if no device in ultrabay the notebook work perfect - if any device in ultrabay (dvd writer or accumulator) an error is present   a) when i remove the ultrabay device a