Using JavaScript to auto populate a field based on numeric value of a separate drop down field

Hello, I am trying to set up a simple, I hope, javascript which will enable to me auto populate one field based on the numberic value of another field using Acrobat Pro XI.
Essentially I have 2 drop down fields (we'll call them DD1 and DD2).
DD1 is the sum of 8 preceding drop down values. That sum can be anywhere from 0 - 40. Whatever that sum falls within a range which identifies a rating. The ratings and ranges are below:
0-8: Non-Performer  
9-16: Low Performer  
17-24: Performer  
25-32: High Performer  
33-40: Exceptional Performer
DD2 is where the rating ("non-performer", "low performer", etc.) will be captured. Instead of requiring the user to look at DD1, determine the value, and then identify and input the rating manually, I would like DD2 to auto populate the rating based on the value (sum) in DD1.
For example, if DD1 shows a value of 27 then DD2 would auto populate "High Performer". So how do I write this code or execute this? In excel I would use an if, then statement. Is there something similar in Acrobat Pro XI.
Any help is greatly appreciated. Thank you in advance.

If you use a text field, the custom calculation script could be:
// Custom calculation script for text field
(function () {
    var s = getField("DD1").valueAsString;
    // Blank this field if input is blank
    if (!s) {
        event.value = "";
        return;
    // Convert string to number
    var v = +s;
    // Set this field's value based on the input
    if (v <= 40 && v >= 33) {
        event.value = "Exceptional Performer";
        return;
    if (v < 33 && v >= 25) {
        event.value = "High Performer";
        return;
    if (v < 25 && v >= 17) {
        event.value = "Performer";
        return;
    if (v < 17 && v >= 9) {
        event.value = "Low Performer";
        return;
    if (v < 9 && v >= 0) {
        event.value = "Non-Performer";
        return;
    // If none of the above fit, blank this field
    event.value = "";

Similar Messages

  • I need to calculate based on a value chosen in a drop down list!!

    Ok, here's the deal.
    I'm writing an order form for custom guitars.
    There will be a dropdown list for many things.
    Example:
    Body Shape : (Shape A, Shape B, Shape C)  <-(dropdown list)
    Body Color : (Color A, Color B, Color C)  <-(dropdown list)
    all three shapes and colors have different costs.
    So for example, if the base cost is $450
    and chosing
    Shape A = +$0
    Shape B = +$50
    Shape C = +$65
    Color A = +$0
    Color B = +$15
    Color C = +$35
    So after the customer chooses the shape and Color, I want the final price to display in the "Price" box.
    So if I chose Shape B & Color C in my dropdown list, the price would read $535.
    Is this possible?
    If so, do I need to write a seperate calcuation for it?? How do I do it?

    If all of your items in a given drop down box have a unique price you can set the export value for each option.
    The custom calculation for the total price field could be, with the field names of "Body Shape" and "Body Color":
    var nBase = 450;
    var nShape = Number(this.getField("Body Shape").value);
    var nColor = Number(this.getField("Body Color").value);
    event.value = nBase + nShape + nColor;
    If you created a hidden field for the base price you could use the "Field is the sum of the following fields:" and select the field names.
    You could also use the Simplified Field Calculation:
    450 + Body\ Shape + Body\ Color

  • Changing fields based on database values

    Hi all,
    I have one form and two drop -down fields. The fields are Call Type and Sub Call Type and are on the SAME form. I pull data from the Call Type from the database. When the user selects a particular Call Type, I need to go back to the database and pull in values associated with that particular Call Type.
    This is the method, that I am using:-
    1) I first populate the Call Type drop down field by using a Server Side Method to fill in values for the Call Type and calling the database.
    2) I then call a method called as PopulateSubCallType by using the property On Change Invoke for the Call Type field.
    In this method I again call the database and based on the Call Type selected by the user, I pull in the associated Sub Call Types and store them in an array.
    3) I also call the same array to populate the Sub Call Types based on Call Types. But the drop down field for Sub Call Type is not auto-populated based on the values from the array. The array values although pulled up from the database are not shown on the form.
    Can you tell me a way to auto-populate the Sub Call Type from the database based on the Call Type selected by the user but on the SAME form.
    I AM NOT USING JSP's but ONLY ALBPM 6.0 PRESENTATIONS.

    refreshValidValues("someAttribute") is a method that comes with BPM Object presentations.
    This one line in this method will work because it causes the attribute (child in this case) to automatically invoke the method you created for retrieving the valid values of the children of the parent.
    Your server side method that dynamically returns valid values of the children based on the parent selected should be looking something like this:
    for each ...
    select * from child
    where parentOfChild = parentAttribute
    In this example the name of your parent attribute is "parentAttribute" column in the child database table that contains the parent's id is "parentOfChild".
    This causes the list of children to auto populate in the child combo dropdown automatically.
    To summarize - at runtime here is what happens:
    a) since the parent has a dynamic method that populates its valid values, as the presentation initializes the SQL for the valid values of the parent is run.
    b) the parent's combo dropdown is populated with a list of valid values of the parent
    c) the end user selects one of the parent's names from the combo dropdown
    d) this causes the method to fire that has only one line. This one line has the text "refreshValidValues("nameOfTheChildAttributeGoesHere")
    e) since the child has a dynamic method that populates its valid values, when the previous step caused this child attribute to refresh its valid values, the SQL in the method that dynamically retrieves the valid values of the child is run.
    f) the end user clicks the combo dropdown on the child's attribute and sees that the child valid values (based on the parent that was just selected) now appear.
    Dan

  • Cond display of drop down based on value selected in another drop down form

    Hi,
    I have a requirement in my app in which I need to be able to conditionally display the values in the drop down down list based on the values selected in another drop down list...
    Currently I have 2 drop downs.
    First drop down is a list of Jacks from 2000 to 4999...
    Second Drop down consists Chassis ranging from 1 to 900..
    So when a user selects any jack between 2000 - 2999, in the second drop down only Chassis ranging from 1 to 300 should appear.
    when anything between 3000 - 3999 is selected, Chassis ranging from 301 to 600 should appear..
    and for jacks between 4000 - 4999, Chassis ranging from 601 to 900 should appear in the second drop down.
    Can someone please provide me pointers on how to do this..
    Thanks,
    Nehal

    Hi Larry,
    Thanks for your response..
    Here are the queries for my select lists.
    P62_JACK
    select list query for Jacks:
    select JACK_NUM display_value, JACK_NUM return_value
    from CTS_LIST_OF_JACKS
    order by 1
    P62_CHASSIS_BLADE_PORT
    select NETWORKPORT display_value, NETWORKPORT return_value
    from CTS_LIST_OF_NETWORKPORTS
    order by NETWORKPORT_ID
    jacks range from 2000 to 4000
    chassis_blade_port ranges from 100 to 900...
    Can you please let me know how to do it..
    Thanks,
    Nehal

  • Change value of another field based on the value of selectOneRadio

    Hello
    I need to display one of two city fields based on the value of a radio group. If the value of the radio group is "Yes", then display the non mandatory city field, if the value is "No", then display mandatory city field. Please can someone help me? The code is below
    <af:subform id="contactForm3" default="true">
                <af:panelForm binding="#{processScope.backing_regDetails.contactPanel3}">
                  <af:selectOneRadio binding="#{processScope.backing_regDetails.radio1}"
                                     labelAndAccessKey="#{MatrixResource['ContactDetails.inBoroughQuestion']}"
                                     layout="horizontal"
                                     valuePassThru="true"
                                     required="true"
                                     onchange="javascript.refresh;" >
                      <f:selectItems value="#{processScope.backing_regDetails.items}" />
                  </af:selectOneRadio>
                  <af:inputText onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value='0';"
                                labelAndAccessKey="#{MatrixCommon['Label.SAO']}"
                                binding="#{processScope.backing_regDetails.houseNameText}"                           
                                maximumLength="240"/>
                  <af:inputText required="true"
                                onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value=0;"
                                maximumLength="240"
                                label="#{MatrixCommon['Label.PAO']}"
                                binding="#{processScope.backing_regDetails.numberStreetText}"/>
                  <af:inputText onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value='0';"
                                maximumLength="240"
                                labelAndAccessKey="#{MatrixCommon['Label.District']}"
                                binding="#{processScope.backing_regDetails.districtText}"/>
                  <af:inputText maximumLength="60"
                                rendered="#{!backing_regDetails.radio1}"
                                onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value='0';"
                                labelAndAccessKey="#{MatrixCommon['Label.TownCity']}"
                                required="true"
                                binding="#{processScope.backing_regDetails.cityText}"/>
                 <af:inputText maximumLength="60"
                                rendered="#{backing_regDetails.radio1}"
                                onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value='0';"
                                labelAndAccessKey="#{MatrixCommon['Label.TownCity']}"
                                required="false"
                                binding="#{processScope.backing_regDetails.cityText}"/>
                  <af:inputText maximumLength="60"
                                onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value='0';"
                                labelAndAccessKey="#{MatrixCommon['Label.County']}"
                                binding="#{processScope.backing_regDetails.countyText}"/>
                  <af:inputText columns="7"
                                onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value=0;"
                                labelAndAccessKey="#{MatrixCommon['Label.Postcode']}"
                                binding="#{processScope.backing_regDetails.postcodeText}"/>
                  <af:selectOneChoice onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value=0;"
                                      binding="#{processScope.backing_regDetails.countrySelect}"
                                      value="#{processScope.backing_regDetails.enteredAddress.countryId}"
                                      labelAndAccessKey="#{MatrixCommon['Label.Country']}">
                      <f:selectItems value="#{backing_regComponents.countryChoiceList}"/>
                  </af:selectOneChoice>
                  <af:inputHidden value="#{processScope.backing_regDetails.enteredAddress.locationId}"
                                binding="#{processScope.backing_regDetails.locationIdHidden}"
                                id="locationId"/>
                  </af:panelForm>
                  </af:subform>Edited by: aademola on Nov 13, 2008 7:35 AM
    Edited by: aademola on Nov 13, 2008 7:42 AM

    Hi,
    you should be able to apply this example to your 10.1.3 project
    see 4.3.2 of http://download.oracle.com/docs/cd/E12839_01/web.1111/b31973/af_lifecycle.htm#CIAHCFJF
    Frank

  • I am currently using FormsCentral to distribute a form created in Acrobat. I need to add an option to one of the drop down fields but do not want to re-distribute the form due to reporting purposes. How can I do this?

       I am currently using FormsCentral to distribute a form created in Acrobat. I need to add an option to one of the drop down fields but do not want to re-distribute the form due to reporting purposes. How can I do this?

    You can open the form in Acrobat, select "File > Save a Copy", open the copy you just saved (it doesn't happen automatically), edit the dropdown to add the new item, save as a new file, and then Reader-enable the file by selecting: File > Save As Other > Reader Extended PDF > Enable More Tools. The resulting PDF should work with FormsCentral just like the original.

  • Based on DDL value ,How to make few other fields visible in Adobe forms in SAP CRM??

    Hi All,
            I need to make few fields visible in adobe forms, based on the dropdown value which user selects.....

    Hi Vignesh,
         In the "EXIT" or "CLICK"event of the particular Drop down field you can write the below code(in Java script).
    if (this.rawvalue == <value> )
          <field name>.presence = "invisible";
    else
        <field name>.presence = "visible";
    Thanks,
    Ashok N.

  • Is there a way to get a drop down field in a muse form? (Not using a third party like jot or Wufoo)

    Is there a way to get a drop down field in a muse form? (Not using a third party like jot or Wufoo) if not then it needs to be a priority for the developers (also radio buttons) as whay should we have to use third party form generators !!
    Thanx

    LOL..... No guru's or employees/staff can answer this simple question ?????
    20+ years in the Advertising Design industry, and would think a simple answer to this would be easy ?

  • How can we use Drop Down Field in RTF Template

    Hi All,
    We have a requirement i.e in the RTF template we have the fields like supplier name,invoice number,invoice amount..etc.And we have a field Total that gives the sum of invoice amount.
    Our Requirement is we have to take "Total" field as a Drop down field.When we click on Total field it has to display the invoice numbers and invoice amount based on that Total.
    Could any one please provide us any solution.
    Thanks in Advance,
    Dhana

    You want to create an Interactive report - where the parameters are not part of the report, but part of the template?
    What is the expected output format PDF, HTML, RTF?
    I don't understand how total coudl be a drop down field? Why does total not directly contain the number?
    Do you want to generate a form that alllows the user to enter data fields and then recalculate the total
    based on the user input? So you want to create a form, not a report?
    Klaus

  • Infopath 2013 - Values are not appearing in a drop down field referencing site column which uses lookup in custom list

    I have a master custom list that has a set of site columns. For each site column there is a lookup to a custom list with reference data. When I edit the list in data entry view all values in drop down fields work fine, but when I customize the form for
    the master list, no data appears in the drop down fields. I can change the data binding on the form so it references the the correct data and when I preview the form it works. But when I publish it, no data is available in these drop down fields.

    Hi  shakonarson,
    According to your description, I try to reproduce your scenario but the lookup field works fine.
    When we customize the form for the  list  in the InfoPath 2013 , it is by design that the Drop-Down List Box control cannot  display its value.
    For troubleshooting your issue, please take steps as below:
    Go to lookup List Box on your form in  InfoPath 2013 , right click it and choose “Drop-Down List Properties” from the bottom of your field menu.
    Make Sure you select “Get choices from an external data source” and correct Data source.
    Make Sure the Xpath  of Entries is “d:SharePointListItem_RW” under the dataFields.
    Here is a good blog for sorting lookup column DropDown by customizing your list form with InfoPath you can have a  look:
    Sort SharePoint lookup column Dropdown by customizing your list form
    with InfoPath
    Hope this helps!
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Auto-populating Infopath fields from a Sharepoint list after selecting a drop down

    I currently have two lists one titled 'Book of Work' which holds details around on-going projects and the other titled 'Book of Work Amendments' which are requests submitted by users to change project details (through an infopath form).
    There is a column in the BoW Amendments list entitled 'Select Project' which has a lookup to 'Project Name' in the BoW list. The aim is that when a user chooses an option from the 'Select Project' drop-down, other fields in the form such as 'Project Manager',
    'Project Description' will be automatically populated with data from that row in the BoW table.
    I have connected both Sharepoint Lists as data connections with BoW Amendments being the primary and BoW the secondary. If we take the Project Manager field as an example the method I have attempted is as follows:
    . Create a rule with condition Select Project is not blank
    . Action - Set a field's value: Field: Project Manager (BoW Amendments - Primary) Value:
    Project Manager (BoW - Secondary) Add Filter: Project_Name (BoW - Secondary) =
    Select Project (BoW - Primary)
    Currently this is not populating the field when the project is selected in the drop down, any assistance would be greatly appreciated.

    Hi Josh,
    This should be straight forward. You do not need BOW Amend data connection. You are creating requests in this list so this will be your Main Data Connection.
    When creating the rule on the drop down, select Action:
    Condition: anytime the value changes, Set a field's value - Project Manager (Main); Value - Project Manager(BOW) where Project[BOW] = Project [Main]
    Hope it helps.
    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

  • Have an onchange event in SPD to update a list based on user selection of data view drop down?

    Hoping someone can point me in the right direction: I have a list for Media announcements, each one of these announcements will have various types of documents associated (via look up field in the doc library). I am trying to have a data form web part (dropdown)
    as the selector (as I am not liking the SharePoint list filter feature) to have a user be able to select the Media Title, then it refreshes the three web parts on the page (1 for the announcement, then one for type1 docs and one for type 2 docs.)
    What is the best way to create an onchange event to have the selected option be connected to the first web part (media title on a list view) so that the information on the page can all be filtered?

    Hi,
    Would you mind providing more details about your requirement? Are there one Announcements list and two Document Library in a page?
    Suppose you have one Announcements list and two Document Library in a page, then you want to add a Drop Down Menu(not the OOTB SharePoint List Filter Web Part) to filter the
    three List View Web Part dynamically.
    There will be two workarounds:
    1. Use the OOTB “Connections” feature of the list to “Get Filter Values From” one of the three lists, then there will be a “Select” button in that list, we can click it to filter
    other two lists/libraries. This is a way without code though we may not have the Drop Down Menu;
    2. Add three <iframe> in a page, then add a Drop Down Menu in this page. Now, we will need some JavaScript to listen to the onchange event of this Drop Down Menu. We can
    get the values populated in the Drop Down Menu from one of the column of one of the list, when making a selection in it, we can pass an URL with query strings to the three iframes which will show the three different lists or libraries.
    The second way requires some code to interact with Client Object Model cause we need to get values from a list, some script to handle the onchange event, which seems more suit
    with your need.
    Here are some links might be helpful if you want to take the second way:
    About how to find a specific element on a page using JavaScript:
    http://javascript.info/tutorial/searching-elements-dom
    Handle the onchange event using jQuery.change function:
    http://api.jquery.com/change/
    About query string to filter a list view:
    http://techtrainingnotes.blogspot.com/2012/03/sharepoint-search-filter-or-sort-lists.html
    About change the src attribute of iframe:
    http://stackoverflow.com/questions/3730159/changing-iframe-src-with-javascript
    http://www.w3schools.com/jsref/prop_frame_src.asp
    Best regards
    Patrick Liang
    TechNet Community Support

  • Acrobat X Pro Drop-down Fields Do Not Appear on Adobe Reader for iPad. Help!

    Hello,
    I am having a problem getting drop-down fields to appear on Adobe Reader for iPad. Basically, I need to create a form that includes drop-down fields, with the end result being a form that can be viewed and completed on an iPad, using the Adobe Reader app. Above all else, the end result needs to be viewable on an iPad.
    I created a form using Acrobat X Pro within which drop-down fields work flawlessly. However, when I try to open this form on an iPad, the drop-down fields do not even appear. I have done some investigating on the Web (including these forums) and come to understand that this has to do with javascript limitations on Apple products, but have yet to discover a solution to my problem.
    To summarize: does anyone know how to make drop-down fields appear in Abobe Reader for iPad app? Or, does anyone know a workaround in which I could have a drop-down menu (or something similar) in my form and have it work on Adobe Reader for iPad?
    Thanks in advance for the help. I took on this project from my boss' boss, so I'd really like to get this done for him.

    Hello GKaiseril,
    Thanks for the reply. I experienced the issue running the most recent version of the Adobe Mobile Reader app. I'm not sure I can convince the client to use anything else, but its worth a shot.
    All I need is a simple drop-down list (multiple fields in the document) with 4 options that the user can select and submit as a form. Is this something EZ Pdf reader can do? Also, is EZ Pdf Reader free? (the reason I ask is I am an Android user and do not readily have access to a iPad).
    Thanks again.

  • Binding web service to multiple drop-down fields.

    I am getting alogn quite well using Web Services with Adobe XFA Forms. I was able to bind very complex web services results to dynamic PDF Forms.
    I was also able to bind Drop-Down Items to a web service.
    I still need little help though.
    I have 2 Drop-Down Fields:
    Hijri Year
    Hijri Month
    They are retrieved by Web Service developed over SAP Systems.
    The web service will return a nested XML Structure of Hijri Year Array of Items, where each Year Item, will have nested array of months item.
    When I click on the button to execute the Web Service, the Year Drop Down is populated. So now how to populate the Month Drop-Down Items ?
    It is a bit tricky, and I cannot figure out what to do.
    Please help.
    Tarek.

    Well, I was almost about to do that with very little coding, but looks like it is not possible. I seems that I have to bind the XML to the dorp-down manually.
    I am using Stefan Web Service Per-Processor model. I am capturing the web service reulst, and loading the node I want to xfd.datasets.data.
    I am doing something like this:
    Sample XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <AttendancePeriod>
       <item>
          <Year>1430</Year>
          <Periods>
             <item>01</item>
             <item>02</item>
             <item>03</item>
             <item>04</item>
             <item>05</item>
             <item>06</item>
             <item>07</item>
             <item>08</item>
             <item>09</item>
             <item>10</item>
             <item>11</item>
             <item>12</item>
          </Periods>
       </item>
       <item>
          <Year>1431</Year>
          <Periods>
             <item>01</item>
             <item>02</item>
             <item>03</item>
             <item>04</item>
             <item>05</item>
             <item>06</item>
             <item>07</item>
             <item>08</item>
             <item>09</item>
          </Periods>
       </item>
    </AttendancePeriod>
    </root>
    DataConnection Post Execute Event:
    var rootXml = null;
    var soapFault = null;
    if (xfa.event.soapFaultCode)
    soapFault = {code:xfa.event.soapFaultCode, message:xfa.event.soapFaultString};
    else
    rootXml = xfa.datasets.connectionData.DataConnection.Body;
    preProcessor.processResponse(rootXml, soapFault);
    The Response Processor function:
    * Called after the web service response has been received.
    * @param rootXml XML node which is the root of the web service response XML data. Null if a fault occurred.
    * @param soapFault Object with 'code' and 'message' properties if a fault occurred; null otherwise.
    function processResponse(rootXml, soapFault)
    console.clear();
    if (rootXml)
      var AttendPeriod = rootXml.GetAttendancePeriodsResponse.AttendancePeriod;
      xfa.datasets.data.root.nodes.append(AttendPeriod);
      xfa.form.remerge();
      console.println(AttendPeriod.saveXML());
    else if (soapFault)
      console.println("Error = ");
      console.println("Fault code: " + soapFault.code);
      console.println("Fault message: " + soapFault.message);
    console.show();
    Then, I will bind the drop-down list to the XML.
    The above code is working fine, but the only problem is xfa.form.remerge(), which will clear all other fields, I am not sure why ?
    Seems I have to use a loop to bind the list items one by one, right ?!!
    Tarek.

  • Drop Down Field issue with Acrobat 8.0 and Acrobat 7.0

    Hi All,
         I have a dynamic table with a drop down field  which will be filled from a WD context.The minimum row count for the table is  one.
    The problem is i was able to get the Drop down values for all the rows  in Acrobat Reader 8.0 and i was able to get drop down values only for the first row(minimum row count is one) in Acrobat Reader 7.0.
    What could be the difference?
    Thanks
    Gopal

    It's a result of Mozilla's annoying rapid-update policy. We can load plugins (i.e. can display a PDF file within the Firefox window) but cannot load extensions (the toolbar) unless they are marked as compatible with the running version of the browser. Not only is that version now changing every 6 weeks, but developers are forbidden to mark an extension as being compatible before the new version is released to market (i.e. we cannot certify against betas). With each major release in the new Mozilla rapid cycle, the type of code Adobe uses (binary XPCOM) has to be recompiled from scratch - so as of right now the Create PDF extension doesn't work in FF7 even if you turn off compatibility checks. It should work, but Firefox won't allow it to execute.
    It means that every time Mozilla pushes a new major version to the public, XPCOM extension developers have to push an update as well. Adobe already get hammered for requiring users to update too often! However, each time Acrobat and Adobe Reader push a scheduled patch they should catch up with whatever version of FF exists at that time. The next Acrobat Family patch is due mid-January.
    It's not just Adobe who are affected by this - many other vendors include FF extensions with their products (as opposed to having them as standalone items on the Mozilla site) and cannot realistically bring out new versions of their software every time Firefox flips up a digit.

Maybe you are looking for