Creation of calculation based on the result of the drop-down list

Hello. I hope that someone will be kind enough to help me with some Javascript because it seems that I am too blonde and middle ages to figure out by myself.

I have a drop-down list box 'Member '. The Yes value is 0. The value is 10.

Then I have three check boxes. "Day 1" value is 35. "Day2" value is 25. 'Dinner' value is 65.

If this option is enabled, I want the sum of the check boxes, if they are checked. (for example, total if all checked = 125)

If no is selected, the value of each check box rose 10. (for example, total if all checked = 155)

I use Acrobat X.

Thanks in advance.

Due to the fact that you want to add a constant number of values if a given condition is met then you will need to use a custom calculation script.

get the value of the fields

var cMember = Number (this.getField("Member").value);

var nDay1 = this.getField("Day1").value;

var nDay2 = this.getField("Day2").value;

var nDinner = this.getField("Dinner").value;

define a varaiable for the sum

var sum = 0;

day 1 more SETTINGS

If (nDay1! = "Off") the sum += (nDay1) Number + cMember;

day 2 more SETTINGS

If (Day2! = "Off") the sum += (nDay2) Number + cMember;

more dinner SETTINGS

If (nDinner! = "Off") the sum += (nDinner) Number + cMember;

Event.Value = sum;

Excel is easy if you would see Microsoft calculations.

Tags: Acrobat

Similar Questions

  • Different calculation based on the drop-down list

    I'm trying to figure out how to change the formula of a derived field in the selection in an adjacent drop-down list.

    For a simple example, trying to find the total amount paid on a loan, would you go Total paid = capital + (main * Int * time). But you may pay more depending on if you pay a fee.

    So what I have works when I enter the formula in the field "Total paid", but trying to integrate the list drop-down for the fees (which is either "Yes" (value = 1) or "No" (value = 2)), I can't figure out how to add the tax, which is $ 50.

    In the drop-down menu, I like an output event:

    Switch (this.rawValue)
    {
    case '1 ':
    totalPaid.rawValue = capital + (Principal * (rate / 100) * time) + 50;
    break;

    case '2 ':
    totalPaid.rawValue = capital + (Principal * (rate / 100) * time);
    break;

    }

    Could someone take a look at this and tell me what I'm doing wrong? I'll post a link to the form that you can see the details (if I do this right!)

    https://Acrobat.com/#d=L7YF3np55Dc7aBOM46qITw

    Thank you!

    Hello

    You just need to use .rawValue to access the value of each object.

    Here is the form to the you: https://acrobat.com/#d=7J3ho * YeHyJzQLK1AEFtWw

    Good luck

    Niall

  • show/hide fields based on the drop-down list of choices

    I have a field from the drop-down list with three choices. Based on the selection, I need a specific text form field to appear and the others to stay hidden. (Or if it makes the code cleaner, the resulting field could be a drop-down list, too, with the selected choice.) I don't know Java well enough to extrapolate the code from the examples online and it fit my forms. I can provide an example of form. Thanks in advance for your help.

    There are ways to run this.  the easiest for you would be to add this script to the event (calculation of the Properties tab) to calculate the field that must be hidden.  Take notes, all "/ /" is some tips for you to understand the code.  You will need to put this script in all the areas you want to replicate the behavior, change the value depending on what you want to accomplish.  the word 'event' means myself to make you understand.

    If (this.getField("dropdown").value == 'put value here') {//replace "drop down" with the name of the drops}

    Event.Target.Display = display.visible;

    }

    else {}

    Event.Target.Display = display.hidden;

    }

    This works if you have a small amount of fields.  If you manage to have a large number of similar fields, let me know because there are other, faster ways.

  • Is this possible? Subforms appeal based on the drop-down list associated with the database

    I'm hoping to make a dynamic shape and I wonder if it's possible.

    I have a database with about 300 entries - pieces of agricultural goods and a few little bits of info on each of these properties. I want to create a form where users can choose the piece there rather than the property in a drop-down list. Based on the property they select, another menu drop down to fill with the cultures associated with this property. Then based on the selection made in this drop-down list, a specific form will be brought upward.

    For example, a person selects property #102 in the drop-down list. In the database, property #102 is associated with wheat, barley and corn, so the next drop would be complete with these three cultures. The user selects the wheat in the drop-down list and the form of wheat would be called. 

    I hope I explained that well enough.

    Is this possible? And if it's possible, how complicated to do? Assuming that I already have the database and subforms, it would be a long process from weeks to the script, or it would be simple enough?

    Yes, this could be done, here is an example that should help: Drop dependent dropdown (specimen attached)

    On the basis of selection (change event of the second menu drop-down), you can show or hide a subform.

    -Wasil

  • How the auto fill a field based on the drop-down list unless the specific item is selected

    Hi all

    My apologies if I posted this in in the wrong place, but I am new to these forums, JavaScript and Adobe LiveCycle.

    I am trying to build a form using LiveCycle Acrobat but have problems with the drop-down lists.

    Inititaly I just wanted to fill in the fields in a table based on a matching menu selection dropdown in another table.

    I used the following code and it worked fine:

    Workbook.Content.Table1.Row3.AppropriationDetails.Row4.Cell1::change - (JavaScript, client)

    fFrom var = xfa.resolveNodes ("Workbook.Content.Table1.Row3.AppropriationDetails [*]. Row4.cell1');

    OTF var = xfa.resolveNodes ("Workbook.Content.Table2.Row3.AppropriationDetails [*]. Row4.cell1");

    for (var i = 0; i < = fFrom.length - 1; i ++) {}

    fTo.item (i) .rawValue = fFrom.item (i) .boundItem (xfa.event.newText);

    }

    The problem is that now I want the code above works UNLESS one of the items in the drop-down list is enabled specifically in this case, I want the text box in the other table to display a message such as "Details of the entry in the field below.

    I tried to create an If Else statement using the following code:

    Workbook.Content.Table1.Row3.AppropriationDetails.Row4.Cell1::change - (JavaScript, client)

    fFrom var = xfa.resolveNodes ("Workbook.Content.Table1.Row3.AppropriationDetails [*]. Row4.cell1');

    OTF var = xfa.resolveNodes ("Workbook.Content.Table2.Row3.AppropriationDetails [*]. Row4.cell1");

    for (var i = 0; i < = fFrom.length - 1; i ++) {}

    If (fFrom.item (i) .rawvalue = "Option 3") {}

    fTo.item (i) .rawValue = "enter the details in the field below.

    }

    else {}

    fTo.item (i) .rawValue = fFrom.item (i) .boundItem (xfa.event.newText);

    }

    }

    The code now filled the field with "Enter the details in the field below" any item I select in the drop-down list.

    Your help is greatly appreciated.

    See you soon,.

    ozzy_q

    Hello

    You use .rawValue in the change event. This will cause problems because the selection of the users has not received .rawValue from the drop-down list at the time when the change event is triggered.

    Move your script as it should to the output of the dropdown event.

    Hope that helps,

    Niall

  • Change the value in the field based on the drop-down list

    Let me start by saying that I consider myself as a rookie full when it comes to this program, but I'm learning. I have a drop down menu containing two choice (white or bright white) based on the selection in the drop-down list, I would like to change a field value to reflect the appropriate part number (Alpha numeric if it matters). I'll have 10 fields that will be either / or a value based on the selection. I searched the forums, but without understanding the terminology still, it is difficult to find the answer.

    Thanks for any help.

    Wayne

    Oh, OK.  So add "select" to the list and then on the value tab, select the default value: drop-down list and choose the item you want to appear by default.  I think that's what you're looking for.

  • JavaScript to fill the text based on the drop-down list field

    Hello

    I'm trying to write a javascript script to fill a "Textfield" based on what I select in 'Dropdownlist control' this has on a relationship between them. I tried to integrate the script on the category of 'Change' and the script was the following, but it didn't work. I would be grateful if someone can help me with the correct procedure.

    Thank you

    Vijay

    Form1. #subform [0]. DropDownList2 [0]: change - (JavaScript, both)

    function populateDescription() {}

    if (document.subform [0].) {DropDownList2 [0] .value == "BIH")}

    document.subform [0]. TextField83 [0] .value = "Burn in and PBI history."

            }

    }

    I solved this problem by using a script to switch.

    Please see my previous thread in this regard and Paul example will provide you with the right script for a script to switch.

    http://forums.Adobe.com/thread/479021

    script on the drop-down list as follows

    Switch (this.rawValue) {}

    case "dropchoice1".

    FieldName1.RawValue = 'choice of text here ';

    FieldName2. RawValue = "choice of text here ';

    break;

    case "dropchoice2".

    FieldName1.RawValue = 'choice of text here ';

    FieldName2. RawValue = "choice of text here ';

    break;

    }

    Good luck.

  • Returns a value based on the drop-down list

    I am a newbie making the PDF form and had recently started working with a Live cycle to create a form to fill out and succeeded in creating an a model for use with the good example of order (by trial and error) that came with the installation. Can someone help me please this form.  I have a drop-down list on the POINTS column and want to automatically display the unit price of the selected item in the drop-down list. Either way, I managed to make the fluid table.

    menu.JPG

    http://Forms.stefcameron.com/2009/02/25/expandable-table-with-totals/

  • Show/hide fields based on the drop-down list

    Hello

    I'm trying to show/hide subforms with a drop-down list selection. I found a lot of information on the subject and ended up with what my script:

     form1.Page1.Division::exit - (JavaScript, client)
    
    switch (Page1.Division.rawValue)
    {
       case "1":
       SubformZZI.presence = "visible";
       SubformZZR.presence = "hidden";   
          break;
     
       case "2":
       SubformZZI.presence = "hidden";
       SubformZZR.presence = "visible";       
          break;
    }
    
    

    However, it does nothing when a selection is made in the drop-down list. I have the "SubformZZI" initially defined as 'Visible' and the 'SubformZZR', originally defined as "hidden".

    Any suggestions?

    Kind regards

    ZeroZone

    Check if the form is saved in dynamic form. File-> save as and choose dynamic for the type of shape...

    Other that that, you should check if you have given the values for the selection of the drop-down list as '1' and '2' in the tab of the control's binding.

    Thank you

    Srini

  • Jdev v.10.1.3.4 - hide inputtext af based on the drop-down list box

    Hello

    I'm trying to hide and display a text entry box based on what is selected by a drop-down list box. I have some difficulty getting the javascript code I think that to read the value of the selection box.

    Here is a simple example of what I'm trying to do. I tried a couple of different ways but no luck. I appreciate any help anyone can offer.

    Thank you
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
    <f:view>
      <afh:html>
        <afh:head title="test">
          <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
    
        </afh:head>
        <afh:body>
    <f:verbatim>
            <script type="text/javascript">
            function changed(){
               if(document.getElementById("current").value =="1" ){
                document.getElementById("currentSize").style.display='block'; //show textbox
                }
                else{ 
                document.getElementById("currentSize").style.display='none'; //hide textbox
                }
            }
            
            </script>
    </f:verbatim>
        
        
        
        <h:form>
            <af:selectOneChoice id="current" label="select item" onchange="change();">
              <af:selectItem label="item 1" value="1"/>
              <af:selectItem label="item 2" value="2"/>
              <af:selectItem label="item 3" value="3"/>
              <af:selectItem label="item 4" value="4"/>
            </af:selectOneChoice>
          <af:inputText label="Input Size:" maximumLength="5" id="currentSize" columns="7" rows="1"/>              
          </h:form></afh:body>
      </afh:html>
    </f:view>

    It works if you use af:form instead of h:form?
    What happens if you set the partial relaxation of the af: form to point to the 'current '?

  • Check generate some Comp based on the drop-down list box and the selection list?

    I currently have a dropdown list with the three sizing options in it. Then I have two check boxes, one is ticked ideally would create the model to its normal size composition and if other is checked that it would reverse the widthxheight in the size of the composition. Then below that I have a "Generate" button, I want to be able to click and according to my selections, it creates the model.

    Looks like I need a kind of if then statement, but I'm having a hard time putting the two together. See below what I have so far.

    There may be missing parts, but I have it all working in a decibel pallate currently. I don't have functionality related to a button again.

    Any help would be appreciated!

    (also I don't know how to format the script spread here so apologies for that)

    ---------------------------

    palette controls

    templateGen.VerticalCheckbox = new Object();

    templateGen.HorizontalCheckbox = new Object();

    set the values for controls

    templateGen.comLookup = new Object();

    templateGen.compLookup = 'Template1 ';

    templateGen.compLookup = "Template2";

    templateGen.compLookup = "Template3."

    function templateGen_getHashValues (hash)

    { // {{{

    var ary = new Array();

    for (k hash) {}

    ARY.push (Hash [k]);

    }

    return area;

    } // }}}

    menu "composition".

    var panelGrp1 = templateGen.palette.add ('Panel', undefined, 'Templates Comp');

    compGrp1 = panelGrp1.add ('group', undefined, 'List templates');

    compGrp2 = panelGrp1.add ('group', undefined, 'Orientation');

    compGrp3 = panelGrp1.add ('group', undefined, 'Generate');

    templateGen.compList = compGrp1.add ('dropdownlist', LIST_DIMENSIONS, templateGen_getHashValues (bapple.compLookup));

    templateGen.compList.helpTip = "choose the type of desired here device model. All compositions are 60 fps. « ;

    templateGen.compList.selection = 'Template1 ';

    templateGen.compList.graphics.foregroundColor = darkColorBrush;

    templateGen.VerticalCheckbox = compGrp2.add ('checkbox', undefined, 'Portrait');

    templateGen.VerticalCheckbox .value = true;

    templateGen.HorizontalCheckbox = compGrp2.add ('checkbox', undefined, 'Horizontal');

    templateGen.HorizontalCheckbox .value = false;

    templateGen.generateBtn1 = compGrp3.add ('button', undefined, 'Generate');

    applyBtn.onClick =? ;

    When I work with drop-down menus, I always liked to tie the data they represent (like the width and height of the model in this case) directly to the elements.

    I run the code to really check, but it should work like this:

    -----------------

    Add models to your drop-down list and store the items in a table

    models var = [];

    models [0] = templateGen.compList.add('item','template1');

    models [1] = templateGen.compList.add('item','template2');

    models [2] = templateGen.compList.add('item','template3');

    set a width and height of each element

    models [0] .width = 1280;

    models [0] .height = 720;

    models [1] .width = 1024;

    models [1] .height = 768;

    models [2] .width = 1920;

    models [2] .height = 1080;

    Choose the item that should be selected by default

    models [0] .selected = true;

    applyBtn.onClick = function() {}

    read the width and height of the selected item

    var width = templateGen.compList.selection.width;

    var height = templateGen.compList.selection.height;

    {if (templateGen.VerticalCheckbox.value)}

    swap width and height

    var temp = width;

    width = height;

    height = temp;

    }

    now create your comp here with the given width and height

    }

  • Fill in the cc field, based on the drop-down list values

    I know this question has been posted before, but I am very new to this, and the answers I found to date are over my head.

    I am trying to create a submit button that will not only send email to a specific address, but also the carbon copy someone when their name is selected from a drop-down list in the form.

    I don't know much about javascript - and this seems to be the way to achieve this - but I do not know where to enter the JS to get this functionality or syntax. The field I use is called "Supervisor1", and I attributed values (e-mail addresses) to each of the names in the menu dropdown.

    Can someone help me get there?

    Thanks in advance!

    Hello

    If you are a beginner of script, you might think this useful macro.

    It can add a script to mail to a normal button.

    http://thelivecycle.blogspot.de/2012/05/mailto-maker-Marco-v1.html

  • Best practical Question - update the query (see object) based on the drop-down list selection

    I have a question about the most efficient way to perform the following task:

    I create a page that contains several DVT components to display data based on specific requests.  Top of page I am hoping to have a drop down menu (selectOneChoice) that contains dates different and based on what the user selects (i.e. 2010, 2011, 2012, 2013, etc.), this will update the query in the view object of some (i.s. WHERE Date = '2011', or WHERE Date = 2013"), and then you view the appropriate data in the DVT.  What is the best way to do this - from a point of view bean managed / page, as well as the View object?  Advice/documentation would be appreciated.

    Thank you!

    When you drag the vo executeWithParams one another that will create links for operations such as 'executeWithParams2', 'executeWithParams3 '. On the method that you use to update a view by calling the executeWithParams operation, you call the other operations too.

    Timo

  • The floating field value based on the drop-down list selection (sex)

    Hi, I have created a form that will have different fields, dropdowns etc where the answers will fill a range of fields floating in a letter. I would like to have a list drop-down for sex (m/f) and if selected, either fill in the letter as 'he' or 'she. ' Is this possible?

    Hello

    Here are some ways to do it in this sample https://sites.google.com/site/livecycledesignercookbooks/home/HeShe.pdf?attredirects=0&d=1

    Unrolling of male/female can have a bound value from it, which means we can do refers to the value directly, without however going any calculation.  Is there are a lot of places where it needs to be replaced, then you can simplify things by making reference to the field to form directly, although this requires to change the XML, but if you won't find yourself with a hidden for each instance field.  Or you could edit the XML Source and change the reference for the same id of a floating field.  There are examples of both in the sample linked above.

    Concerning

    Bruce

  • Best way to do the math based on the drop-down list box selections

    I've set up a timesheet that employees choose in two different drop-down fields which department they worked in and what station they worked at for each section start and end time. What I'm trying to do, is to have a summary table on the bottom of the timesheet which calculates the time spent for each combination.

    Timesheet snapshot.png

    Departments are N & S, P and so our stations are WN, ZO, LR and FM, the table would look like this:

    WN ZO LR FM
    N & S
    P
    A

    I have three sections of the hours of beginning and end with each of them their time in separate fields called M1, M2, and M3 calculation.  What I'm trying to implement is an if statement for each cell in the table. For example:

    If 'deptmonday1' = N & S and 'stationmonday1' = WN

    then x = M1

    and

    If 'deptmonday2' = N & S and 'stationmonday2' = WN

    then y = M2

    and

    If 'deptmonday3' = N & S and 'stationmonday3' = WN

    then z = M3

    If cell 'WNN & S' = x + y + z

    Can someone help me with the script for my if statements or y at - it an easier way to understand this? I use Acrobat Pro.

    Code custom for "WNN & S" calculation:

    var x = 0;

    var y = 0;

    var z = 0;

    If (this.getField("deptmonday1").value == "N & S" & this.getField("stationmonday1").value == "WN")

    x = Number (this.getField("M1").value);

    If (this.getField("deptmonday2").value == "N & S" & this.getField("stationmonday2").value == "WN")

    y = Number (this.getField("M2").value);

    If (this.getField("deptmonday3").value == "N & S" & this.getField("stationmonday3").value == "WN")

    z = Number (this.getField("M3").value);

    Event.value = x + y + z;

  • FormCalc help - trying to multiply or divide based on the drop-down list

    So I'm a complete noob to this and Livecycle learning.

    I tried to make this formcalc script but its all wrong, I'm sure.  I have a dropdown menu with 3 variables (annual, quarterly, monthly), I need to take the amount in the box "given amount" and based on 3 variables come with the monthly amounts.

    If (giving regularity == 'Each year') then

    Amount given/12

    on the other

    If (giving regularity == "Quarterly") then

    Amount given/3

    on the other

    If (giving regularity == "Monthly") then

    Given amount * 1

    endif

    I'm sure it's very basic, but I would appreciate any advice from you in the pros.

    Capture.PNG

    Hello

    Make sure that you call your objects with the names of right...

    Object names can not have spaces, so when you specify "Given the regularity" or "Given amount", both are bad...

    don't forget to refer to these values to the right objects

    If you are not sure how to call these objects, you can still use the features of LiveCycle with Ctrl + click on the object...

    For example:

    Make sure your cursor is in the Code Editor, while now Ctrl, hover your mouse over the object to, you should see the change in your mouse to an arrow pointing down, then click on the left button of your mouse (still in holding the CTRL key)

    In your editor, you will see the reference to the object that you want to retrieve the value, it's how you call your object

    I hope this will help you!

Maybe you are looking for