Conditional adding and substracting numbers with Acrobat Javascript.

Hello,
I'm having the following Javascript problem, and i'm hoping that someone on this forum can help me solve it.
I have 2 checkboxes, the field names are the same (MinusAlreadyPayed), but they
have different export values.
The export value of the first checkbox is "No", the export value of the other one is "Yes".
Next to the checkboxes is a field called "AlreadyPayed" where an amount (euro currency) can be entered.
Further down the form i placed the number (currency) field "Cost1" and below that another number (currency) field called "Cost2".
Below that field there is a copy of the "AlreadyPayed" field, i placed an transparent button above it, so it can't be filled in.
Below that there is another number (currency) field called "Total".
This field should add the fields "Cost1" and "Cost2" and subtract the field "AlreadyPayed", but only if the exportvalue
of the field "MinusAlreadyPayed" is "Yes" (second checkbox selected).
Is there a way to do this ?
Thanks   :-)
Flash.

Sure. You can use something like this as the total field's custom calculation script:
var cost1 = Number(this.getField("Cost1").value);
var cost2 = Number(this.getField("Cost2").value);
var alreadyPaidAmount = this.getField("MinusAlreadyPayed").value=="Yes" ? Number(this.getField("AlreadyPayed").value) : 0;
event.value = (cost1 + cost2) - alreadyPaidAmount;
On a side-not, placing one field on top of another is not a good idea, as the z-order of the fields will change each time you edit one of them. I would look for another solution, like renaming the check-box and using a script to populate it with the value of "AlreadyPayed".

Similar Messages

  • The infamous Conditional Formatting and page numbers

    I've been digging through these posts and I see that conditional formatting and page numbers is a common topic, but none of the posts I've seen seem to come up with an answer to my suituation:
    (Apologies in advance, I know this has been covered in many previous posts, just don't seem to be able to decipher a clear answer...)
    I have a client who wants a boilerplate item - the word "OVER", to signify a miltiple page report - to be printer on the botton right of the page, BUT as usual there are seeveral conditions when they want it NOT to show.
    First, they wnat it to only print when a specific Source is selected. That's a database field, and I have that conditional formatting piece working,
    Second, they only want it to print on ODD numbered pages, I think I can use something like MOD(SRW.GET_PAGE_NUM(x),2)=0 to determine whether or not it's an odd numbered page, but havn't been able to try it yet,
    Third, if the report is only a single page they don't want it to print at all. Not sure how to accomplish this, since the holy grail of the conditional formatting seems to be the total number of pages, and none of the posts I've seen have been able to get this.
    Any ideas?

    The "Select All" button selects all cells that have the format you are looking at. It makes it so you can easily modify them all at once.

  • How to find by DEFAULT the EXACT text string (and no more) with Acrobat Pro?

    How to find by DEFAULT (always) the EXACT text string (and no more) with Acrobat Pro? Adobe Acrobat Pro 9.2.0 search engine finds USELESS hits on Mactel with Mac OS X 10.5.8.
    For instance, if I search for "sec" (no quotes) trying to find ONLY hits with sec (for second, like in: it took 20 sec), it finds useless hits like: security, etc (any word containing sec, which is NOT what I want).

    Any idea on how to do it by default with Adobe Acrobat Pro 9.3.1 on Mac OS X 10.6.2 (Snow Leopard)? Thanks.

  • Embedded audio and video files with Acrobat x Pro

    Can an audio or video file be embedded in a document with Acrobat x Pro & opened with Adobe Reader xi?

    You can place video or sound files onto the pages of a PDF file using the Multimedia button on the Tools Pane > Content Panel. The result is called a Rich Media Annotation, and will play back on the desktop versions of Adobe Acrobat and Adobe Reader.
    The files have to be compatible with Flash Player, so videos need to be in H.264, FLV or F4V, and audio files in MP3.

  • Right clicking PDF files and printing those with Acrobat Reader X

    We have a Windows XP computer with Adobe Acrobat 7 Professional and Acorbat Reader X.
    Now when we open PDF files they open with Acrobat Reader X wich is fine.
    But when we try selecting PDF files and right click Print them they print with Acrobat 7 Professional.
    The problem is with Adobe Acrobat Professional 7 it doesn't print all the files we selected.
    We select 50 files and only about 10 are printed and those are always random.
    So is there anyway to enable the print option to print with Acrobat Reader X ?

    This is not a desirable situation. Adobe recommends against having Reader and Acrobat on the same machine, unless they're both version X, exactly because it can cause this kind of conflicts.

  • HT3743 I bought a used iPhone 3 from eBay my husband tried to update it and all that comes up on the screen now is the imei and iccid numbers with iTunes icon and a USB have I bought a dud or what

    I bought an iPhone 3 from eBay and when my husband tried to update it all that comes up on the screen is the imei and iccid numbers along with the iTunes icon and a USB. I can only use it for emergency calls as that is all that happens when I slide it on. Have I paid $250 for a dud phone or what can I do to fix it. Any help would be appreciated .

    Sounds like your iPhone was hacked to unofficially unlock it. You can put it in Recovery mode, connect it to iTunes and Restore it in iTunes. Then you will need to call AppleCare, give them the model and serial numbers and find out which cell provider it is locked to. After you get that information contact that cell provider and see if you can get it officially unlocked.

  • Adding and removing children with buttons

    So I've been following this tutorial (http://www.danfergusdesign.com/classfiles/oldClasses/VCB331-richMedia1/exercises/addingChi ldren.php) on how to add and remove children with buttons in order to create a popup box on the stage.
    The part I'm having trouble with is how I add the close button to the stage on top of the popup box.
    This is basically what I'm trying to do:
    Here's my code right now:
    var OrderPrepOnlineMenuInstance:OrderPrepOnlineMenu = new OrderPrepOnlineMenu();
    var mcOnStage:Boolean=false;
    loadOrderPrepOnlineBtn.addEventListener(MouseEvent.CLICK, loadMC);
    OrderPrepOnlineClose.addEventListener(MouseEvent.CLICK, removeMC);
    function loadMC(MouseEvent):void {
    addChild(OrderPrepOnlineMenuInstance);
    OrderPrepOnlineMenuInstance.x = 465;
    OrderPrepOnlineMenuInstance.y =230;
    mcOnStage=true;
    function removeMC(MouseEvent):void {
    if (mcOnStage ) {
    removeChild(OrderPrepOnlineMenuInstance);
    mcOnStage=false;

    Why not just make the close button part of the object you are adding.  You can assign it an event listener thru that object after it is created.

  • Is there a tutorial/primer for working with conditional text and page numbering in book folders?

    I'm ramping up on FrameMaker 9 and have been experimenting with using folders in book files. I like being able to add Frame files to the folder to organize content. But I also need to use conditional tags. In one version of my book, the entire contents of some files in one folder are hidden using conditional text. I can't figure out how to set the numbering for each file so that the page numbers adjust appropriately in this scenario. Or is it even possible to do this?
    Can anyone recommend an advanced tutorial for using folders in Frame 9?

    Michelle,
    It would be easier to maintain if you create a different book file that omits the entire "conditionalized" set of files.
    See these Adobe TechComm blogs for some more background info on using hierarchical books and numbering behaviour:
    http://blogs.adobe.com/techcomm/2009/05/xml_authoring_projects_using_hierarchical_books.ht ml
    http://blogs.adobe.com/techcomm/2009/06/numbering_in_hierarchical_books.html

  • Baffling Problem with Acrobat Javascript

    I'm hoping someone can help me. I've tried for hours and hours to find what the trouble is but just can't find a solution.
    The following code works, however, this is the baffling part. I need to edit / update the code but the problem occurs when I make ANY changes to the code - even indenting a line. You will notice that the code is not indented and poorly formatted - that's because when I had the code indented, I repeatedly got a "SyntaxError: missing } in compound statement"
    I am completely baffled as to why sometimes I get the SyntaxError and sometimes not. I swear there are instances where the code worked one time and then another time causes a SyntaxError.
    Tried using Adobe Javascript Debugger, tried running code through jslint.com, tried creating a new PDF file and placing this code in that file - still getting SyntaxError if I change or indent the code. The only thing I haven't tried yet is trying it out on the Windows version.
    I'm using Acrobat Pro 10.1.3 (Creative cloud) on a Mac OS X Lion 10.7.4
    Any help would be really appreciated!
    var trackErrors = 0;
    var errorMessage = 'Please complete all of the required fields';
    if (this.getField('1A').value.length === 0) { errorMessage += ' A Wall Height '; trackErrors++; }
    if (this.getField('1B').value.length === 0) { if (trackErrors === 1) { errorMessage += ', B Wall Length '; } else { errorMessage += ' B: Wall Length '; trackErrors++; } }
    if (this.getField('1C').value.length === 0) { if (trackErrors === 1) { errorMessage += ', C Spacing '; } else { errorMessage += ' C: Spacing '; trackErrors++; } }
    if (this.getField('1-4-radio').value === 'Off') { if (trackErrors === 1) { errorMessage += ' and Material Type - Fabric or Laminate.'; } else { errorMessage += ' Mat type'; trackErrors++; } }
    if (trackErrors === 0) {
    var x, y, v, z, kits = '';
    var flag = 0;
    this.getField('1D').value = this.getField('1B').value / 2;
    this.getField('1E').value = this.getField('1D').value / this.getField('1C').value;
    this.getField('1F').value = Math.floor(this.getField('1E').value);
    this.getField('1G').value = this.getField('1F').value + (this.getField('1F').value - 1);
    this.getField('1H').value = this.getField('1A').value * this.getField('1G').value;
    var materialType = this.getField('1-4-radio').value;
    switch (materialType)
    case 'F':
    x = this.getField('1H').value / 32;
    y = Math.ceil(x);
    this.getField('bw-kits-required').value = y + " Kit Required";
    break;
    case 'L':
    x = this.getField('1H').value / 128;
    y = this.getField('1H').value / 32;
    if (flag === 0) {
    if (x === Math.round(x)) { kits += x + ' kit '; flag++; }
    if (y === Math.round(y)) { kits += y + ' kit '; flag++; }
    v = Math.floor(x);
    x -= v;
    if (v > 0) { if (x < 0.75) { kits += v + ' kit'; v = Math.ceil((x * 128) / 32); kits += ' and ' + v + ' kit'; } else if (x >= 0.75) { kits += (v + 1) + ' kit '; } } else { kits += Math.ceil(y) + ' kit'; }
    this.getField('bw-kits-required').value = kits;
    break;
    } else { app.alert(errorMessage); }

    I don't get the same thing in Acrobat 9 on Windows XP. It would be interesting to see what happens if you copy what you posted here on the forum and use it.
    I would suggest changing code like:
    if (this.getField('1A').value.length === 0)
    To something like this:
    if (this.getField('1A').valueAsString.length === 0)
    If you use the value property and the field value is numeric (or "true" or "false"), it won't have a length property because the type of the value isn't "string", so it will be undefined. Since the special value of undefined is not equal to zero the code works, but it's a bit misleading. It could be further refined to just:
    if (!getField('1A').valueAsString)

  • Install and setup problem with Acrobat XI pro

    I have downloaded the Acrobat XI Pro trial program, with no error messages. When I clisk on "setup.exe" the following error message appears, see screen shot :
    "This patch package could not be opened. Verify that the patch package exixts and that you can access it, or contact the application vendor to verify that this is a valid Windose Installer patch package"
    How do I get setup to start?

    @Jeff -- Yes I did use theDownload assistant.  Down load completed and assistant started the insall.  Received the error message and install terminated. Searched for and found the install folder and have tried install by clicking on"setup.exe".  Have not tried a fresh download, did the MSI logging, see next reply.
    @LeoAdobeX -- I renamed the file\folder path and eliminated all spaces. Clicked setup.exe and received same error message.
    Enabled MSI logging and tried setup.exe, received same error message. Have posted 2 most recent MSI files and the setup.ini file. Here are the links:
    https://workspaces.acrobat.com/?d=SxkkNEXK*bJLZnkDjFdWiQ
    https://workspaces.acrobat.com/?d=Mdt6KyNSpBViV3h2ZC2pUg
    https://workspaces.acrobat.com/?d=AOxVXVIBozy1XrFDwzljoQ
    Thanks for your help. Will stand by,

  • Conditional text and table numbers

    I have a source doc from which I am going to generate two user guides (I am new at this). I have two conditional tags set, which I plan to show/hide as required to generate the final PDFs.
    First snag: I have a products specification table, which is different for each guide. Using auto numbers, I have created the first table (1-1).
    Then I add the second table (prod specs for the other product). It of course shows up as table 1-2 (and all sequential tables will be misnumbered). Using the Show/Hide command, I see the correct table.
    How do I get correct sequential table numbers for each end document?
    Thanks very much.

    >  ... FrameMaker help refers to these as "series labels."
    Thanks for the further clarification, Mike.
    Just poking around on this, it's unclear exactly how many different series labels one can have. Some sources say we're limited to 53:
    default(no letter), A: to Z:, a: to z:
    Some sources say it's 63:
    default(no letter), A: to Z:, a: to z:, 0: to 9:
    which also seems to work.
    Curiously enough some other single characters appear to work as well. I just tried @:, #:, non-breaking hyphen (\x15) and generic currency symbol (\xdb) for example (this is in FM7.1, entered as \x hex codes). I suspect most basic Frame roman single "standard" characters might work, which would imply a possible 255 or so counters. Two-letter labels just get treated as literal text, as would any multi-byte Unicode I suspect.
    Adobe has no published "best practices" for series labels, but if one searches around the web, a common theme develops on conventions. Any shop would be well advised to pick a convention, and (note to self) write it down, for example:
    B: body (ordinary paragraphs)
    C: call-outs
    F: figures
    H: headings (volume, chapter, section, etc.)
    O: outline
    S: steps
    T: tables

  • Adding and substracting rows

    Hi Guys,
    I got a query like this
    with time (select sysdate time from dual),
    select all.* from (
    select nvl(col1,'Total') col1,nvl(col2,'Total') col2,count(col3) col3 from tbl_output group by cube(col1,col2)
    union all
    select col1,'Total input' col2,count(col3) from tbl_input group by col1,col2) all
    and it gets me total input and output and some detailed rows,
    Now i want to calculate the remainder of total input and output,
    how to do this?
    Because I need to add rows / substract rows marked with total not columns?
    Hope i make any sense

    user12228228 wrote:
    Because I need to add rows / substract rows marked with total not columns?
    Hope i make any senseUhm, sorry... Can you post a small, yet complete example of what you want to achieve. Post the CREATE TABLE and INSERT statements along with the expected outcome and the logical behind the expected outcome.

  • Fax and scan problem with Acrobat Reader DC

    My Acrobat Reader just updated to the new Reader DC program, and now I cannot send any faxes that contain any PDF documents using the Windows Fax and Scan program .  Has anyone else seen this problem?

    Hi Pascal,
    In case is you have not created the back for them before installing Adobe Acrobat Reader DC you won't be able to get them back.
    Regards,
    Aadesh

  • I have a mac book pro i want to have another monitor added and open garageband with 2 projects open is this possible.

    I have a mac book pro I want to use 2 monitors and have garageband open with 2 projects is this possible?

    GarageBand can open only one project at a time.  Project are treated differently from audio files; you can have many audio files open in QuickTime or other audio players, but GarageBand will always close the current project when you open a new one.
    If you have the newest GarageBand 10.0 and the previous version, GarageBand '11, version 6.0.5, you can open one project in GarageBand 10.0 and one project in GarageBand '11.
    However, you cannot drag and top between the windows or transfer media. And once a project has been converted to GarageBand 10 format, it can no longer be opened by GarageBand '11.

  • Why my signature and stamp disappear with Acrobat Reader DC version ?

    I have just install the new Acrobat Reader DC but my signature, paraph and stamp saved in the prevoius version, have disappeared. What is the way to make them back ?

    Hi Pascal,
    In case is you have not created the back for them before installing Adobe Acrobat Reader DC you won't be able to get them back.
    Regards,
    Aadesh

Maybe you are looking for

  • Adobe Acrobat 9 prof. Vers. 9.5.5. Fehlerprotokoll

    Ich habe ein Problem mit Adobe Acrobat 9 prof. Vers. 9.5.5. Wenn ich eine pdf-Datei erstellen will (z.B. aus Dateien, Webseiten etc), erscheint regelmäßig ein FP: Funktion "Einstellungen-Datei wird geöffnet oder erzeugt" konnte nicht beendet werden,

  • Active ODP when both 9 and 10g are installed...

    I have both ODP 9i and ODP 10g (along with the Oracle 10g client) installed on my workstation. How does one set up one or the other to be the 'active' ODP client? For instance, I have an application that I developed under ODP 9i... because I develope

  • My B750 wont boot up!!!!!

    I can just bought this laptop and I can get everything to work, press F2 and all that but this stupid laptop wont work! I hear that little sound thingi, like after the windows sign comes up and it saying powering up, but it never shows my icon to cli

  • Controller Errors

    Hi, I created a button on my main page (called createHeader). What I am trying to do is go to a "manage page" when clicked on that button....and then insert into the table. I have the following code in my controller: /*===============================

  • Hot Backup for oracle database?

    Dear all, I want to change Cold Backup to Hot Backup. Does anyone how to do Hot Backup and has some simple document I can follow? If the database is running in ARCHIVELOG mode, is the size grow very fast or other effect will overcome? Please advice,