Determine number in a field based on word-choice in a drop-down menu

I'm trying to insert a number in a field based on a word I've chosen in a drop-down menu.
Example:
I have a drop-down menu named "Fruits". In that menu is "Orange", "Apple" and "Banana".
I have a different field called "Price". If the user selects "Orange" in the "Fruits" drop-down, the value of "Price" is 10. If the user selects "Apple" the value of "Price" is 15. If the user selects "Banana" the value of "Price" is 20.
Been working with this for awhile, and feel like Im very close, but can't get it to work. If someone could help me I'd be grateful.
Thanks,
T.

Thanks to both of you. I realize this is more complex than I thought, and that I didn't state my challenge correctly. Let me try again:
I have a number of textual items in a dropdown, let's say "Apples", "Bananas" and "Cherries".
I have an array of form fields, with different properites expressed as a numeric value, say: "Size", "Weight", and "Cost".
Each of the items in the dropdown has a value for each of the fields.
So when I select an item from the drop-down I want to populate the entire array from the values associated with the items in the drop down. Different items will fill the array of values (I actually have 28 properties in the array and about 7 items in the drop-down). The items will always have a value for all the properties in the array, but I want the user to be able to override all entries. So enter custom text in the drop-down, which would provide blank fields in the array, which could also be overwritten by the user.
Hope that makes sense, and I apologize for my earlier attempt at describing this. It's hard enough to do in plain English, there's no way I can make this happen in Javascript, LOL!
Thanks in advance for your patience and help.
T.

Similar Messages

  • Filter query based on a value from a drop down menu

    I am using ADFBC/JDev 10.1.3/ADF-faces (JSPX)
    I would like to display a table of data based on a view object and have a drop down menu of values that the user can select from which would filter the table of data. The filter would be applied to a field in the VO. For example, have a JSPX page that shows all employees and have a drop down menu that filters the employees by a specific department with an option to show all departments too in the drop down. I'm not sure if Steve Muench's example #76 (http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html) would serve as a basis for this requirement or not.
    Can anybody give me high level guidance on how to do this? Both declaratively and programmatically would be great.
    Thanks,
    Quoc

    I can't get the JSPX page to display the correct data. It's displaying the entire VO and when you try to select Yes or No or All from the drop down menu, it just changes the Active Flag column in the table to whatever you select for the first row only and still displays the rest of the rows in the VO.
    Here's my JSPX code:
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:af="http://xmlns.oracle.com/adf/faces"
              xmlns:afh="http://xmlns.oracle.com/adf/faces/html"
              xmlns:cust="http://xmlns.oracle.com/adf/faces/customizable">
      <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
                  doctype-system="http://www.w3.org/TR/html4/loose.dtd"
                  doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
      <jsp:directive.page contentType="text/html;charset=windows-1252"/>
      <f:view>
        <afh:html>
          <afh:head title="showEmployees">
            <meta http-equiv="Content-Type"
                  content="text/html; charset=windows-1252"/>
          </afh:head>
          <afh:body>
            <af:messages/>
            <h:form>
              <af:panelForm>
                <af:selectOneChoice value="#{bindings['bind_active_flag1'].inputValue}"
                                    label="#{bindings['bind_active_flag1'].label}">
                  <f:selectItems value="#{bindings['bind_active_flag1'].items}"/>
                </af:selectOneChoice>
                <af:commandButton actionListener="#{bindings.ExecuteWithParams.execute}"
                                  text="ExecuteWithParams"
                                  disabled="#{!bindings.ExecuteWithParams.enabled}"/>
              </af:panelForm>
              <af:table value="#{bindings.EmployeesView.collectionModel}" var="row"
                        rows="#{bindings.EmployeesView.rangeSize}"
                        first="#{bindings.EmployeesView.rangeStart}"
                        emptyText="#{bindings.EmployeesView.viewable ? 'No rows yet.' : 'Access Denied.'}">
                <af:column sortProperty="EmployeeId" sortable="true"
                           headerText="#{bindings.EmployeesView.labels.EmployeeId}">
                  <af:outputText value="#{row.EmployeeId}">
                    <f:convertNumber groupingUsed="false"
                                     pattern="#{bindings.EmployeesView.formats.EmployeeId}"/>
                  </af:outputText>
                </af:column>
                <af:column sortProperty="FirstName" sortable="true"
                           headerText="#{bindings.EmployeesView.labels.FirstName}">
                  <af:outputText value="#{row.FirstName}"/>
                </af:column>
                <af:column sortProperty="LastName" sortable="true"
                           headerText="#{bindings.EmployeesView.labels.LastName}">
                  <af:outputText value="#{row.LastName}"/>
                </af:column>
                <af:column sortProperty="ActiveFlag" sortable="true"
                           headerText="#{bindings.EmployeesView.labels.ActiveFlag}">
                  <af:outputText value="#{row.ActiveFlag}"/>
                </af:column>
              </af:table>
            </h:form>
          </afh:body>
        </afh:html>
      </f:view>
    </jsp:root>Here's the bindings page:
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
                    version="10.1.3.41.57" id="showEmployeesPageDef"
                    Package="view.pageDefs"
                    MsgBundleClass="view.pageDefs.showEmployeesPageDefMsgBundle">
      <parameters/>
      <executables>
        <iterator id="EmployeesViewIterator" RangeSize="10" Binds="EmployeesView"
                  DataControl="AppModuleDataControl"/>
        <variableIterator id="variables">
          <variableUsage DataControl="AppModuleDataControl"
                         Binds="EmployeesView.variablesMap.bind_active_flag"
                         Name="EmployeesView_bind_active_flag" IsQueriable="false"/>
        </variableIterator>
        <iterator id="DropDownIterator" RangeSize="-1" Binds="DropDown"
                  DataControl="AppModuleDataControl"/>
      </executables>
      <bindings>
        <table id="EmployeesView" IterBinding="EmployeesViewIterator">
          <AttrNames>
            <Item Value="EmployeeId"/>
            <Item Value="FirstName"/>
            <Item Value="LastName"/>
            <Item Value="Email"/>
            <Item Value="PhoneNumber"/>
            <Item Value="HireDate"/>
            <Item Value="JobId"/>
            <Item Value="Salary"/>
            <Item Value="CommissionPct"/>
            <Item Value="ManagerId"/>
            <Item Value="DepartmentId"/>
            <Item Value="ActiveFlag"/>
          </AttrNames>
        </table>
        <action id="ExecuteWithParams" IterBinding="EmployeesViewIterator"
                InstanceName="AppModuleDataControl.EmployeesView"
                DataControl="AppModuleDataControl" RequiresUpdateModel="true"
                Action="95">
          <NamedData NDName="bind_active_flag" NDType="java.lang.String"
                     NDValue="${bindings.EmployeesView_bind_active_flag}"/>
        </action>
        <attributeValues id="bind_active_flag" IterBinding="variables">
          <AttrNames>
            <Item Value="EmployeesView_bind_active_flag"/>
          </AttrNames>
        </attributeValues>
        <list id="bind_active_flag1" IterBinding="EmployeesViewIterator" StaticList="false"
              ListOperMode="0" ListIter="DropDownIterator" NullValueFlag="1"
              NullValueId="bind_active_flag1_null">
          <AttrNames>
            <Item Value="ActiveFlag"/>
          </AttrNames>
          <ListAttrNames>
            <Item Value="Value"/>
          </ListAttrNames>
          <ListDisplayAttrNames>
            <Item Value="Description"/>
          </ListDisplayAttrNames>
        </list>
      </bindings>
    </pageDefinition>Any ideas?

  • Show/hide fields when selecting an option from a drop-down menu.

    Hello Gurus!
    I have a question about creating a Java Script withing Acrobat pro.  This is what i would like to do: I created a drop-down menu with several selection entries.  Upon the customer making one of the selection entries, i would like for the correct fields that i created to become visible and all other fields to hide.  Is this even possible to do?  The reasoning behind this is because we have a form that customers have to generate in order to request access to certain financial accounts; we have over 20 different types of accounts and for each instance the customer has to fill out the same form.  By creating a drop down menu, i can use the same form by just changing the drop-down selection and clicking on the designated fields for that selection.  At this time i have over 20 different forms that poing to 20 different account requests and i would hate to send the form 20 different times to one person.  The reason i can not add all fields desired for all accounts is due to the fact that the form would be filled with hundreds of checkmarks and instructions thus making the process too tideous for the customer.  Hope you guys can help out.
    ~Vader

    The good news is, it can be done (and it has been done).
    There are a few things to be aware of, however.
    The most important is that the form must be planned well, which means that you must think carefully about your logic and even more so about your field naming (hierarchical field names are your friend). One fundamental issue, you have to be aware of, is that this form no longer will be a "standard form". The consequence of this is that you may have to be aware that you might get into trouble when you have to prove that your user filled out that particular standard form (talk to your compliance and forms management people about that).
    You also may have to decide whether the form should be usable in Reader. And, if so, how much you want to spend on the right to do so. You will see below why…
    There are actually two approaches for dynamically showing/hiding parts of a form. If your form can be separated between a fixed first page (where you also have the account type selection), and a variable part (depending on the selection), you could use Templates, which you spawn according to the selection, and delete pages when you change the selection. This approach is very easy to implement, but requires Reader Extensions Server to allow it to work in Reader; Acrobat Pro's extended rights are not sufficient for that.
    The other approach is showing/hiding fields. If you did your homework well, it would be very easy to first hide all subsequent fields, and then show the ones you need in two lines of code. This approach does not require extended rights for Reader at all, as long as your forms will always have the same number of pages, for each of your account types. This approach also works for the cases where the differences between the individual forms are very small. It does also work for showing/hiding bigger chunks of the form. In that case, you might create the "background" separately, and then put it as an icon into a button field which you will show/hide together with the carefully placed on top of it active fill-out fields.
    There is a third possibility, which Adobe Propaganda probably would suggest, and that woudl be subforms in LiveCycle Designer. The consequence is, however, that you won't have PDF forms, but proprietary XFA forms instead. And you may have more developing and maintenance work than with the other approaches.
    Back to your original question: you could use a Keystroke script evaluating event.changeEx of the combo box field. Depending on that, you would run your action to set up the according form part. The other way to do it would be evaluating event.value in the onBlur event. The latter would have the advantage that the selection has been made, and you get a bit more time to set up the form (this may in fact be an issue, particularly with Acrobat 9 and 10, which may take their time to show/hide fields).
    Another possibility instead of a drop down (combo box field) would be a popup, where you would have a button to press, and the list of selections pops up. This second method uses app.popUpMenuEx().
    Hope this can help.
    Max Wyss.

  • I need to define the acceptable answers in a text field by what is selected in a drop down menu.

    Hello please help.
    First, I am new to form creation in Acrobat XI Pro so please be patient with me.
    I am creating an electronic invoice with the client list in a drop down menu. When the service person selects the client, the pricing fields need to have limitations set on them.
    If I can figure out the script to set it for one selection from the drop menu, I can figure out the others.
    Example of the three important scripts:
    If GCO is selected in the drop menu then 80 and 0 are acceptable in the hook up field.
    If GCO is selected in the drop menu then mileage = TM -5. If TM - 5 is < 0 then Mileage only = 0. If TM -5 > 0 then (TM - 5) * 3.5
    If GCO is selected in the drop menu then Fuel Charge = 0
    Any help would be great. Thanks!

    Can you please provide a screenshot showing the issue? I have no idea what's happening to you, what with all the caps and all.

  • How do I use Javascript to populate a text field based on a selection from a drop down box?

    Greetings,
    I have virtually no experience with JavaScript and I am trying to figure out how to add some basic automation features to an Adobe form.  I have a drop down box called "Hospital_Name" that will contain approximately 7 possible selections.  When the user makes a selection, I would like to have the text field (called "Hospital_Address") below the drop down box populate with the corresponding address for the selection.  I have the "Hospital_Address" text field configured for multiple lines and would like the address to have a line break between the street address and the city/state/zip.
    For example, if the user selected "Hospital 1", the text field would display:
    123 Main St
    Anytown, CA 12345
    Any help or examples you can provide would be greatly appreciated.

    You have the element names within the object within brackets.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    // some debugging code to see location names;
    console.show();console.clear():
    for(I in Location) {
    console.println(I);
    // end debugging code;
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;
    This is not a beginners task but requires a fair amount of knowledge about the structure of objects, defining strings, and structure of arrays.
    Are you sure you have all the field names correctly spelled and capitalized?
    Do you get any error in the JavaScript console?
    Just trying the line that defines the "Location", I get the following error:
    SyntaxError: invalid property id
    1:Console:Exec
    undefined
    All the form field in a PDF are processed by using JavaScript and any error in any script will stop JavaScript processing.
    It might help to have a link to the problem form.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;

  • My web based email: When creating an email, entering the to, cc, or bcc, after typing first intials, it no longer gives me a choice in a drop down menu. HELP

    Until about 2 days ago, I did not have any problem with my webbased GoDaddy email. Now with your update, I can not put in the first letters of the person nor group I am emailing and choose from my email dropdown list of potential email contacts either individual nor group. Instead, I have to go to the directory, choose who I am emailing, find them by sorting, select them, one by one, and then click done for each one, then go back to the email. What a hassle! I called GoDaddy, they said it is the browser. I have my you with my frequent pins up on this browser. I checked internet explorer, and it works like yours use to work. I click the To: box, start typing the person's name and there is a drop down list that enables me to choose the person or the group. HELP

    Sorry I have no solution but this happened to me after Hulu told me to clear my browser cache (history) to be able to watch a video that stopped abruptly (Hulu lied; you rarely need to clear the cache.)
    You can back up your browser history to keep this from being a problem in the future. Follow the instructions at [[https://support.mozilla.org/en-US/kb/Backing%20up%20your%20information#w_locate-your-profile-folder|https://support.mozilla.org/en-US/kb/Backing%20up%20your%20information#w_locate-your-profile-folder]]

  • Trying to change my phone number. screen says to choose area code from drop down menu but it is blank and won't let me go further

    I am trying to change my phone number. Screen says to choose area code & prefix from drop down menu.  Drop down is blank.  Will not let me go further

        Hello llamamama9,
    Yikes! I'm sorry to learn you are having issues with changing your mobile number. I understand how important this options is. I'm dedicated to making sure this is completed once and for all. I know some time has passed since your original post, have you changed your mobile number? If not, please visit http://vz.to/V668o0 If you are still having issues after following this guide, please feel free to reach out to us, thanks!
    MatthewS_VZW
    VZW Support
    Follow us on Twitter @VZWSUPPORT

  • I'm trying to find a word processing app that is comparable with Microsoft word, that supports drop down menu's for filling out forms. Any recommendations?

    I'm trying to find a word processing app that is comparable with Microsoft Word, but can use drop down menu's to fill in forms? Any suggestions

    Microsoft Word for Mac
    OpenOffice
    NeoOffice
    LibreOffice

  • Changing some fields based on Attribute Choice

    Hi BC community - looking for some help.
    One of my clients, requires a cumulative volume discount from 3 products.  The only way I could do this in BC was to create one product, and add different flavor choices as an attribute.  This works great.  Now, I have a small problem.  She wants some of the fields to change depending on which attribute drop down is chosen.  We need to be able to change a few different things:
    - Product Name (would then become the Attribute Name)
    - Large Product Image
    - And a text field (I am currently using my only available text field of {tag_tags} for this particular content.
    Any suggestions? I see there is a choice for the Product Image from this link: Business Catalyst Help | Manage product inventory but I need to change some other text.
    Thanks in advance!
    Aaron

    I was hoping to avoid doing that.
    I considered making a wizard style interface to do it with
    multiple steps, but when I do that and resubmit the page to itself,
    I lose page elements such as my nav bar and head( they ae included
    in all pages)
    Is there some other way I can handle this?

  • Create a dynamic form where selected text boxes appears, based on options chosen in a drop-down box

    HELP!!! Can anyone please provide some guidance on how to create a dynamic form where selected text boxes appears, based on options chosen in a drop-down box.
    I have a form which – based on the department that's selected from a drop-down box – will have different form fields/text boxes, etc, made available.
    Is this possible in LiveCycle, if so, can you please provide the script/info - as needed.
    Thanks,

    In the preOpen event of the second dropdown list you put something like (in formCalc):
    if (dropdown1 == 1) then
    $.clearItems()
    $.setItems("Year, 2 Year,  3 Year")
    elseif (dropdown1 == 2) then
    $.clearItems()
    $.setItems("3 Year,  4 Year")
    endif

  • Input Masks and Single Choice Fields (drop down menu) Suggestions

    Here's a few suggestions - I hope this is the right place to post these...
    1. I would like to suggest a pre-filled state single choice field (drop down menu) to be used to get address information.  Or better yet a way to import a csv file to fill the preset fields for an option box.
    2. Input masks that force users to enter the data in the format you prefer.  (000) 000-0000
    3. Ability to enable or disable options depending on other choices.
    4. Option for a list of numbers say 1 thru 100 and as people pick a registration (car number in my case) that choice cannot be picked again by another user for that form.  Load values from a table that can be picked several times or only once could work in both my suggestions.
    Thank You.

    Hello there,
    Thanks for these thoughts! They're all really good (and welcome) suggestions for additions to the FormsCentral service. As you might imagine, we're busily working back here to implement new features; we have big plans for FormsCentral. For these suggestions in particular, I'll do two things:
    1. Send these suggestions to the product team and get them added to the to-do list!
    2. Move the whole thread here into the FormsCentral Ideas sub-forum. That way, your suggestions will be noted as such and well-documented on our end.
    Thanks for the great ideas; let us know if you have any more feedback for us!
    Best regards,
    Rebecca
    Acrobat Services Community Manager

  • Making drop down menu for entry fields in database

    <%@ page language="java" contentType="text/html" %>
    <%@ page import="java.io.*" %>
    <%@ page import="java.math.*" %>
    <%@ page import="java.util.*" %>
    <%@ include file="/global/util.inc" %>
    <%@ include file="/global/user_session.jsp" %>
    <%@ include file="/global/connection_prepare_marketing.jsp" %>
    <html>
    <head>
    <title>Marketing Data Entry</title>
    <LINK REL=STYLESHEET HREF="/global/app_main.css">
    <BODY bgcolor=#FEFFE8>
    <%
    int     CID = 0;     
         CID = Integer.parseInt(request.getParameter("cid"));
    if (request.getParameter("delete") != null) {
         // Do the delete via a PreparedStatement
            java.sql.PreparedStatement ps = null;
         ps = db.prepareStatement("delete from hit_or_miss where hom_ID = ?");
         ps.setInt(1, CID);
         ps.executeUpdate();
         CID = 0;
         out.print ("<font color=darkblue>The record has been deleted successfully</font>");
    if (request.getParameter("update") != null) {
           // Set inputs in order to evaluate
            String          DE = request.getParameter("date_entered");
                   DE = DE.replaceAll("[a-zA-Z]","");             // Get rid of letters
         String          SI = request.getParameter("summit_ID");
                   SI = SI.replaceAll(",","");                 //Get rid of commas
         String          TT = request.getParameter("transaction_type");    //No change needed
           String            NL = request.getParameter("notional");
                     NL = NL.replaceAll("[a-zA-Z]","");               // Get rid of letters
                     NL = NL.replaceAll(",","");                  // Get rid of commas
           BigDecimal      NTL = new BigDecimal(NL);
         String          ST = request.getParameter("structure");
         String          CP = request.getParameter("counterparty");
         String          ED = request.getParameter("expiry_date");
                   ED = ED.replaceAll("[a-zA-Z]","");                // Get rid of letters
         String          SD = request.getParameter("start_date");
                   SD = SD.replaceAll("[a-zA-Z]","");                // Get rid of letters
         String          MD = request.getParameter("maturity_date");
                   MD = MD.replaceAll("[a-zA-Z]","");                // Get rid of letters
         String          CT = request.getParameter("currency_type");
         String          MRKTR = request.getParameter("marketer");
           String            SSC = request.getParameter("sales_credit");
                     SSC = SSC.replaceAll("[a-zA-Z]","");         // Get rid of letters
                     SSC = SSC.replaceAll(",","");                 // Get rid of commas
           BigDecimal      SC = new BigDecimal(SSC);
         String          MRKP = request.getParameter("markup");
                   MRKP = MRKP.replaceAll("[a-zA-Z]","");    // Get rid of letters
                   MRKP = MRKP.replaceAll(",","");           // Get rid of commas
         BigDecimal     MP = new BigDecimal(MRKP);
         String          CC = request.getParameter("comments_color");
      if (     SD != null && MD != null && ED != null ) {
         // First get the ID to use     
            String sql = " "+
              "begin "+
                "declare @new_id int "+
                 "if (select count(*) from hit_or_miss ) = 0 "+
                 "       begin "+
                 "       select @new_id = 1 "+
                 "       end   "+
                 "else "+
                 "       begin "+
                "       select @new_id = max(hom_ID) + 1 from hit_or_miss "+
                 "       end "+
              "select newID=@new_id "+
           "end";
         int nID = 0;
         rs = st.executeQuery(" "+ sql + " ");
         while (rs.next()) {
              nID = rs.getInt("newID");
         // Get timestamp for insert
         java.util.Date curr_dt = new java.util.Date();
            java.sql.Timestamp dt = new java.sql.Timestamp(curr_dt.getTime());
         // Now we check if it is an insert or update based on the passed ID
         if (CID == 0) {
              // Do the insert via a PreparedStatement
              java.sql.PreparedStatement ps = null;
              ps = db.prepareStatement("insert into hit_or_miss values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
              ps.setInt(1, nID);
              ps.setString(2, DE);
              ps.setString(3, SI);
              ps.setString(4, TT);
              ps.setBigDecimal(5, NTL);
              ps.setString(6, ST);
              ps.setString(7, CP);
              ps.setString(8, ED);
              ps.setString(9, SD);
              ps.setString(10, MD);
              ps.setString(11, CT);
              ps.setString(12, MRKTR);
              ps.setBigDecimal(13, SC);
              ps.setBigDecimal(14, MP);
              ps.setString(15, CC);
              ps.executeUpdate();
              out.print("<font color=darkblue>The new record has been inserted into the database successfully</font>");
         } else {
              // Do the update via a PreparedStatement
              // First we insert a row into the archive table
                 java.sql.PreparedStatement ps = null;
                    ps = db.prepareStatement("update hit_or_miss set date_entered = getdate(), summit_ID = ?, transaction_type = ?, notional = ?, structure = ?, counterparty = ?, expiry_date = ?, start_date = ?, maturity_date = ?, currency_type = ?, marketer = ?, sales_credit = ?, markup = ?, comments_color = ? where hom_ID ="+CID+" ");
              ps.setString(1, DE);
              ps.setString(2, SI);
              ps.setString(3, TT);
              ps.setBigDecimal(4, NTL);
              ps.setString(5, ST);
              ps.setString(6, CP);
              ps.setString(7, ED);
              ps.setString(8, SD);
              ps.setString(9, MD);
              ps.setString(10, CT);
              ps.setString(11, MRKTR);
              ps.setBigDecimal(12, SC);
              ps.setBigDecimal(13, MP);
              ps.setString(14, CC);
              ps.executeUpdate();
              out.print("<font color=darkblue>This record has been updated successfully</font>");
      } else {
         out.print("<font color=red>You must fill in the date and amount sections of this form in order the write to the database to occur - please try again</font>");
         String DateEntered_text = null;
         String SummitID_text = null;
         String TransactionType_text = null;
         String Amount_text = "0000000.00";
         String Structure_text = null;
         String Counterparty_text = null;
         String ExpiryDate_text = null;
         String StartDate_text = null;
         String MaturityDate_text = null;
         String CurrencyType_text = null;
         String Marketer_text = null;
         BigDecimal SalesCredit_text = new BigDecimal(0.0);
         BigDecimal Markup_text = new BigDecimal(0.0);
         String CommentsColor_text = null;
         String Notional_text = null;
    if (CID == 0) {
         String Expiry_Date_text = "";
            String Start_Date_text = "";
            String Maturity_Date_text = "";
    } else {
         rs = st.executeQuery("select o.hom_ID, DateEntered=convert(varchar(10),o.date_entered,101), o.summit_ID, o.transaction_type, Notional=convert(varchar(100),convert(money,o.notional),1), o.structure, o.counterparty, ExpiryDate=convert(varchar(10),o.expiry_date,101), StartDate=convert(varchar(10),o.start_date,101), MaturityDate=convert(varchar(10),o.maturity_date,101), o.currency_type, o.marketer, o.sales_credit, o.markup, o.comments_color from hit_or_miss o where o.hom_ID =  "+CID+ " ");
         while (rs.next()) {
              DateEntered_text = rs.getString("DateEntered");
              SummitID_text = rs.getString("summit_ID");
              TransactionType_text = rs.getString("transaction_type");          
              Amount_text = rs.getString("Notional");
              Structure_text = rs.getString("structure");
              Counterparty_text = rs.getString("counterparty");
              ExpiryDate_text = rs.getString("ExpiryDate");
              StartDate_text = rs.getString("StartDate");
              MaturityDate_text = rs.getString("MaturityDate");
              CurrencyType_text = rs.getString("currency_type");
              Marketer_text = rs.getString("marketer");
              SalesCredit_text = rs.getBigDecimal("sales_credit",8);
              Markup_text = rs.getBigDecimal("markup",5);
              CommentsColor_text = rs.getString("comments_color");
    %>
    <table id="main" border=0 cellspacing="4" cellpadding=3 bgcolor="buttonface">
         <tr><td ><form name="myform" method="post" action="/applications/marketing/hit_or_miss.jsp">
    <table  border="0" cellspacing="4" cellpadding="3">
         <tr class=tableHeader>
              <td valign=top colspan=2 >Marketing Form</td>
         </tr>
         <tr>
              <td valign=top><font size="-1"><b>Date Entered:</b></font></td>
              <td>     
                   <input type=text name=date_entered size=8 value='<%=DateEntered_text%>'>
                   <a href="javascript: void(0);"
                   onmouseover="if (timeoutId) clearTimeout(timeoutId); window.status='Show Calendar'; return true;"
                   onmouseout="if (timeoutDelay) calendarTimeout(); window.status='';"
                   onclick="g_Calendar.show(event, 'myform.date_entered', false, 'mm/dd/yyyy'); return false;">
                   <img src='/images/calendar.gif' name='imgCalendar' width=20 height=10 border=0 alt=''></a>
              </td>
         </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Summit ID:</b> </font></td>
                    <td><input type=text name=summit_ID size=25 value='<%=SummitID_text%>'></td>
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Transaction Type:</b> </font></td>
                    <td><input type=text name=transaction_type size=25 value='<%=TransactionType_text%>'></td>
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Notional:</b> </font></td>
                    <td><input type=text name=notional size=25 value='<%=Notional_text%>'></td>
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Structure:</b> </font></td>
                    <td><input type=text name=structure size=25 value='<%=Structure_text%>'></td>
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Counterparty:</b> </font></td>
                    <td><input type=text name=counterparty size=25 value='<%=Counterparty_text%>'></td>
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Expiry Date:</b></font></td>
                    <td>   
                            <input type=text name=expiry_date size=8 value='<%=ExpiryDate_text%>'>
                            <a href="javascript: void(0);"
                            onmouseover="if (timeoutId) clearTimeout(timeoutId); window.status='Show Calendar'; return true;"
                            onmouseout="if (timeoutDelay) calendarTimeout(); window.status='';"
                            onclick="g_Calendar.show(event, 'myform.expiry_date', false, 'mm/dd/yyyy'); return false;">
                            <img src='/images/calendar.gif' name='imgCalendar' width=20 height=10 border=0 alt=''></a>
                    </td>  
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Start Date:</b></font></td>
                    <td>   
                            <input type=text name=start_date size=8 value='<%=StartDate_text%>'>
                            <a href="javascript: void(0);"
                            onmouseover="if (timeoutId) clearTimeout(timeoutId); window.status='Show Calendar'; return true;"
                            onmouseout="if (timeoutDelay) calendarTimeout(); window.status='';"
                            onclick="g_Calendar.show(event, 'myform.start_date', false, 'mm/dd/yyyy'); return false;">
                            <img src='/images/calendar.gif' name='imgCalendar' width=20 height=10 border=0 alt=''></a>
                    </td>  
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Maturity Date:</b></font></td>
                    <td>   
                            <input type=text name=maturity_date size=8 value='<%=MaturityDate_text%>'>
                            <a href="javascript: void(0);"
                            onmouseover="if (timeoutId) clearTimeout(timeoutId); window.status='Show Calendar'; return true;"
                            onmouseout="if (timeoutDelay) calendarTimeout(); window.status='';"
                            onclick="g_Calendar.show(event, 'myform.maturity_date', false, 'mm/dd/yyyy'); return false;">
                            <img src='/images/calendar.gif' name='imgCalendar' width=20 height=10 border=0 alt=''></a>
                    </td>  
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Currency Type:</b> </font></td>
                    <td><input type=text name=currency_type size=25 value='<%=CurrencyType_text%>'></td>
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Marketer:</b> </font></td>
                    <td><input type=text name=marketer size=25 value='<%=Marketer_text%>'></td>
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Sales Credit:</b> </font></td>
                    <td><input type=text name=sales_credit size=8 value='<%=SalesCredit_text%>'><b>%</b></td>
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Markup:</b> </font></td>
                    <td><input type=text name=markup size=8 value='<%=Markup_text%>'><b>%</b></td>
            </tr>
         <tr>
                    <td valign=top><font size="-1"><b>Comments/Color:</b> </font></td>
                    <td><input type=text name=comments_color size=8 value='<%=CommentsColor_text%>'><b>%</b></td>
            </tr>
         <tr>
              <td colspan=2><hr width=100%></td>
         </tr>
         <tr>
              <td colspan=2>     <input type="submit" name="update" value="Update Record"
                        style='width:100px;font:9px verdana;'>
         <% if (CID != 0) { %>
                            <input type="submit" name="delete" value="Delete Record"
                                    onclick="return confirm('Are you sure you want to delete this record?');"
                                    style='width:100px;font:9px verdana;'>
            <% } %>
                   <input type="button" name="close" value="Close Window"
                        style='width:100px;font:9px verdana;'
                   onclick='javascript:window.close();'>
              </td>
         </tr>
    </table>
    </td>
    </tr>
    </table>
    <input type=hidden name=login_id value=<%= request.getParameter("login_id") %>>
    <input type=hidden name=cid value=<%=CID%>>
    <SCRIPT LANGUAGE="JavaScript">
    opener.myform.submit();
    </SCRIPT>
    </form>
    </body>
    </html>thats my code for part of database, in the parts that go "if CID = 0", thats the new record field, in there right now i just have users put in info into blank input fields, however, i would like to know if i can make certain fields, like Mraketer, and Counterparty fields to have drop down menus, Anyone know??

    So basically the main focus of what I was askin is in this block of code below:
    if (CID == 0) {
              // Do the insert via a PreparedStatement
              java.sql.PreparedStatement ps = null;
              ps = db.prepareStatement("insert into hit_or_miss values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
              ps.setInt(1, nID);
              ps.setString(2, DE);
              ps.setString(3, SI);
              ps.setString(4, TT);
              ps.setBigDecimal(5, NTL);
              ps.setString(6, ST);
              ps.setString(7, CP);
              ps.setString(8, ED);
              ps.setString(9, SD);
              ps.setString(10, MD);
              ps.setString(11, CT);
              ps.setString(12, MRKTR);
              ps.setBigDecimal(13, SC);
              ps.setBigDecimal(14, MP);
              ps.setString(15, CC);
              ps.executeUpdate();
              out.print("<font color=darkblue>The new record has been inserted into the database successfully</font>");
         } else {
              // Do the update via a PreparedStatement
              // First we insert a row into the archive table
                 java.sql.PreparedStatement ps = null;
                    ps = db.prepareStatement("update hit_or_miss set date_entered = getdate(), summit_ID = ?, transaction_type = ?, notional = ?, structure = ?, counterparty = ?, expiry_date = ?, start_date = ?, maturity_date = ?, currency_type = ?, marketer = ?, sales_credit = ?, markup = ?, comments_color = ? where hom_ID ="+CID+" ");
              ps.setString(1, DE);
              ps.setString(2, SI);
              ps.setString(3, TT);
              ps.setBigDecimal(4, NTL);
              ps.setString(5, ST);
              ps.setString(6, CP);
              ps.setString(7, ED);
              ps.setString(8, SD);
              ps.setString(9, MD);
              ps.setString(10, CT);
              ps.setString(11, MRKTR);
              ps.setBigDecimal(12, SC);
              ps.setBigDecimal(13, MP);
              ps.setString(14, CC);
              ps.executeUpdate();
              out.print("<font color=darkblue>This record has been updated successfully</font>");
         }     when CID = 0, what it does is it pops up a new window called "New Record" and in this new window, there are boxes where inputs can be made, so that when u hit submit, it submits into the database.
    What I want to do is, for example, there is a input field called "Marketer" where one can type in his own name as the Marketer, I want make this into a drop down box, where you can pick the marketer, and not have to type it in.
    You know how websies have New User, where you create a new user that is added to their database, and usually the COUNTRY field is a drop down menu where you pick the country from. I would like to do that to my database, and this is the area, or the code, that deal w/ new record "IF CID =0" and edit record "ELSE"
    Is this possible?
    Thanks in Advance

  • Error message based on text in a drop-down menu...

    So I have a simple number field and a text drop-down box (with, let's say, the values "Blue", "Red" and "Green".)
    I want to set a minimum and maximum (say between 5 and 20) value on the number field and send an error if the user enters a number outside of that range. BUT the range can be different depending on if the user selects Blue, Red or Green from the drop-down menu.
    So for Blue, the range might be 5-20; for Red 7-22, and Green 10-25.
    SO if the user chooses Blue then enters a 4 or a 21, he'll get an error message prompting him to specifiy a value that is from 5-20.
    That's it, in a nutshell.
    Any help I could get would be awesome. Thanks in advance.
    Thanks,
    T.

    There are several events to consider here:
    1. The drop-down value is changed without any values in the text field
    2. The drop-down value is changed with a value in the text field
    3. The value of the text field is changed (I'm assuming there's no "blank" value in the drop-down, or there will be another event, where the value of the text field is changed when the "blank" option is selected)
    You need to decide how to treat each event. I would recommend resetting the text field each time the value of the drop-down is changed. Otherwise you will need to perform the validation from two different sources.
    To do that add the following code to the drop-down's custom validation script (replace "Text1" with the actual field's name):
    this.resetForm(["Text1"]);
    The code you can use for the text field can be something like this, as the custom validation script (replace "Color Selection" with the actual field's name):
    event.rc = true;
    if (event.value) {
        var color = this.getField("Color Selection").value;
        var min=0,max=0;
        if (color=="Blue") {
            min = 5;
            max = 20;
        } else if (color=="Red") {
            min = 7;
            max = 22;
        } else if (color=="Green") {
            min = 10;
            max = 25;
        var v = Number(event.value);
        if (v<min || v>max) {
            app.alert("Error! The value must be between " + min + " and " + max);
            event.rc = false;

  • Adobe Form... Is there a way to use a drop down menu to highlight or note other fields...

    I am working on a simple Adobe form.  I am currently trying to figure out if there is a way to use the answers of a drop down menu to either mark, note or highlight 14 other fields.  There are 9 possibilities in the drop down menu, include a blank and NONE.
    For example if the drop down menu is set to 1, then field 9, 10 and 14 are marked, noted or highlighted. 
    Is this possible with a script?
    Thank you in advance for any help! 

    Have you looked at the properties that are available to form fields. I would look at setting the fill color or border color for a form field. Either of these can be done with Acrobat JavaScript.

  • How can I set a specific value for a field, according to the option selected in a previous drop-down menu?

    Eg.: I have a drop down menu with the following options: "1,2,3,4,5". What I want to do is the followin: If the option selected is "1" the field "Color" must be filled with "Green", if "2" the field color must be filled with "Red", etc

    You can use something like this as the custom calculation script of the color field:
    var v = this.getField("Dropdown1").valueAsString;
    if (v=="1") event.value = "Green";
    else if (v=="2") event.value = "Red";
    // etc.
    else event.value = "";

Maybe you are looking for

  • Open new browser window from an Applet

    I have an applet that needs to initiate a new browser window to open and go to a specified URL. Can anyone help me with this?? Thanks in advance.

  • Inserting Date and Time Issues

    Hi All, I have a very simple select query as follows... UPLOAD_DATE is held in table1 in the following format:     23/01/2012 13:04:36 <cfquery name="test" datasource="test"> SELECT  UPLOAD_DATE FROM     TABLE1 </cfquery> and I loop around the above

  • Naviage to another iView in Visual Composer

    I am trying to configure navigation from one iView to another. I have going through many tutorials but to no avail. The result of the steps below should be that the ”source” iView is shown. When the submit button is clicked the value in the source_fi

  • LCD Touchscreen Question

    Hello, I have a 42" LCD Touchscreen (from Panelworx) with a integrated CPU that connects to the screen via HDMI. I am running a Flash Projector file in 100%, Fullscreen mode, developed using AS2, CS3. The problem/question is when we shut the monitor

  • Can i activate any verizon phone to my contract if mine broke?

    My phone is broken and I am far from my upgrade date, can i buy any verizon cell phone via ebay or wallmart or anything and activate it onto my existing contract number?