Drop Down Lists and Value Change Events

I have 4 drop down lists each with a set of values from the database.
Based on the value of the first list(ValueChangeEvent only for list1) , I fetch data from the database and set the 'selected value' in the other lists.
I have a Submit button which takes values from these 4 lists and puts it in the database.
Problem:
I change list 2 through list 4 and hit a Submit button which inserts all the values in the database.
However,on Clicking the Submit button I never get the new selected values, it always refers to the previously fetched values.
I tried to recreate this case in a Sandbox without a database , Here is the code:
Page1.jsp
<h:selectOneMenu id="list1" value="#{SessionBean1.selectedList1}" valueChangeListener="#{SessionBean1.list1ValueChangeListener}"  onchange="this.form.submit();" >
               <f:selectItems id="dropdown1SelectItems" value="#{SessionBean1.list1}"/>
</h:selectOneMenu>
  <h:selectOneMenu id="list2" value="#{SessionBean1.selectedList2}" >                           
              <f:selectItems id="dropdown2SelectItems" value="#{SessionBean1.list2}"/>
   </h:selectOneMenu>
   <h:commandButton id="add" actionListener="#{SessionBean1.addActionListener}" value="Add"/>
    <h:inputText id="result" value="#{SessionBean1.result}" />SessionBean1
   public SessionBean1() {
        list1.add(new SelectItem("0","0"));
        list1.add(new SelectItem("1","1"));
        list1.add(new SelectItem("2","2"));
        list1.add(new SelectItem("3","3"));
        list2.add(new SelectItem("a","a"));
        list2.add(new SelectItem("b","b"));
        list2.add(new SelectItem("c","c"));
        list2.add(new SelectItem("d","d"));
        map.put("0", "a");
        map.put("1", "b");
        map.put("2", "c");
        map.put("3", "d");
    private void fetch_data(String value){
         selectedList2=map.get(value);
    public void list1ValueChangeListener(ValueChangeEvent vce){
            fetch_data(vce.getNewValue().toString());
    public void addActionListener(ActionEvent event){
        result=selectedList2;
    }I tried debugging and found that after the Value Change Event is fired only selectedList1 gets a new value during Update Model Values Phase and selectedList2 still has the old value.
With this sand box project I cannot even get the second list to show the corresponding value.
Any insight on this would be helpful

Thank You Balus C,
I just realized the reason why this is not working, I found the reason in your article Populating Child Menu's article, I am just
putting it as a reference here.
One concern is that the skipping of the UPDATE_MODEL_VALUES will also cause that the new values of the menu's which have immediate="true" set won't be set in the backing bean. This can partly be fixed by getting the new value from the ValueChangeEvent inside the valueChangeListener method and assign it to the appropriate property. But this won't work for other menu's of which the valueChangeListener isn't been invoked. This would cause problems if you select a child menu value and then select the parent menu back to null and then reselect it to same value again, the child menu which will show up again would remain the same selection instead of null while its child will not be rendered! To solve this we need to bind the menu's to the backing bean so that we can use UIInput#setValue() and UIInput#getValue() to set and get the actual values.+ The JSF lifecycle will set and get them in the RESTORE_VIEW and RENDER_RESPONSE phases respectively.+
I am not sure I understand whether or not it is a limitation but the reason above is valid and I rolled back to binding my menus and getting to work with that.
Is Binding UI components a wise idea because most of the attributes can be programmed using properties in Backing Beans unless you have to build new components?
Thanks Again

Similar Messages

  • Getting the rawValue of a Drop-Down list on the "change" event

    I am having problems getting the rawValue of a Drop-Down list on the "change" event. It seems that you have to select the same item twice in a row to get the rawValue to be the value of the selected item.
    ::dropdownlist onChange event::
    xfa.host.messageBox(this.rawValue);
    On the first time a value is selected you get 'null'. The second time the same value is selected, you get the selected value.
    Does anyone have any thoughts on why this is happening? Also, I CANNOT use xfa.event.newText, I need to use the rawValue of the dropdownlist.
    Thanks

    The change event occurs before the rawValue is changed. If you NEED to use the rawValue you'll need to use a later event. Perhaps you could use exit so that it gets triggered when the field loses focus?
    Chris
    Adobe Enterprise Developer Support

  • Creating a drop down list and linking it to Excel files

    How to create a drop down list and when i select any row in the dropdown list, it must open designated MS- Excel file? Can anyone help me in this with an example code?
    Thanks
    Anu

    Try this in 7.0 format.
    Attachments:
    Listbox for excel files.vi ‏15 KB

  • Problem in getting the current value of the drop down while calling value change listener

    I have 2 drop down list. I am trying to get the value of first drop down from other drop downs value change listener. Initially one drop down contains a default value. First time I got the value while calling the value change listener. But if I change the default value to other in the first drop down and call the value change listener of the second drop down then I got the old value in the bean. Can anyone suggest a process

    If I use the following code it gives me the current index.
                valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
                System.out.println(valueChangeEvent.getNewValue());
    This is also giving me current index.
    BindingContainer container = BindingContext.getCurrent().getCurrentBindingsEntry();
    AttributeBinding attrIdBinding = (AttributeBinding)container.getControlBinding("PersonTypeId1");
    if(attrIdBinding.getInputValue()!=null)
                   System.out.println(attrIdBinding.getInputValue().toString());
    But at last I got some help from Shay Shmeltzer's Weblog.
    BindingContainer bindings =
                    BindingContext.getCurrent().getCurrentBindingsEntry();
                    // Get the sepecific list binding
                    JUCtrlListBinding listBinding =
                    (JUCtrlListBinding)bindings.get("PersonTypeId1");
                    // Get the value which is currently selected
                    Object selectedValue = listBinding.getSelectedValue();
                      long value =0L;
                    if(selectedValue!=null){
                        System.out.println("Sudip.. Person Type using bindings"+selectedValue.toString());
    But this returns "ViewRow [oracle.jbo.Key[300000860721156 ]]"
    300000860721156 is the original value.. Would you please help me to figure it.

  • Drop down lists and email buttons

    I am creating a form and I have about twenty items in a drop down list. I was wondering if and how I can set it so each item selected will cause an email button I have to change address. i.e item 1 sets the email button to [email protected] and item 2 sets the button to [email protected] I think it has something to do with binding but I only have basic training so I am lost. Any help that you can give will be greatly appreciated . Thank you in advance

    As mentioned, you can´t do that in InDesign but fortunately it´s fairly easy task to do in Acrobat Professional. You didn´t mention what are you sending, just an empty email that sender can fill in email client, whole PDF as attachment or some form data from PDF... all those options are possible by few lines of javascript in Acrobat side.
    I made you a quick sample which just opens up an email client, populates email address based on choise that user has made in combobox and some custom subject and body meassage text. You can find it from my dropbox: https://dl.dropbox.com/u/17227987/sampleform.pdf
    There´s only two formfields in that PDF; combobox for choosing email recipient (AA = [email protected], BB = [email protected] etc) and submit button. Check javascript code from
    -combobox´s properties > Validate tab and
    -button´s properties > Actions > Run a javascript.
    In combobox, small javascript sets the myemail variable´s value based on the choise user makes. In Button there´s small javascript that triggers the email client and uses the value of myemail variable as a target email address.
    ps. this sample probably works only in Acrobat and Adobe Reader. I have no idea how for instance MacOS Preview supports PDF javascript, probably not very well....=)

  • Drop Down Lists, and other Problems after upgrade

    Noticed the problem on http://www.autotrader.com/cars-for-sale/?expandAllOptions=true&Log=0
    Drop down lists do not respond they way they did last week - before 36.0.1 upgrade.
    Choose a brand, and then you are supposed to be able to select from a list of models. Not happening.
    I have several of the privacy add-ons (see below) but they have not changed with the upgrade (unless they too were upgraded automatically.)
    FF is becoming less and less of a joy to use as the years go by.

    Note that your System Details list shows that you have a user.js file in the profile folder to initialize prefs each time Firefox starts.
    The user.js file is only present if you or other software has created this file and normally it wouldn't be there.
    You can check its content with a plain text editor (right-click: "Open with"; do not double-click).
    The user.js file is read each time Firefox is started and initializes preferences to the value specified in this file, so preferences set via user.js can only be changed temporarily for the current session.
    You can delete the user.js file if you didn't create this file yourself.
    You can use this button to go to the currently used Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Show Folder (Linux: Open Directory; Mac: Show in Finder)
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    Windows hides some file extensions by default.
    Among them are .html and .ini and .js and .txt, so you may only see file name without file extension.
    You can see the real file type (file extension) in the properties of the file via the right-click context menu in Windows Explorer.
    See also:
    *http://kb.mozillazine.org/Preferences_not_saved

  • How to use multiple drop down lists and do not allow duplicates.

    I am creating a roster that has multiple positions on multiple pages. I have a drop-down list that is populated with all of the employees and want to make sure that the same employee cannot be selected for multiple posts. Ideally, when one is selected in a position, that person would not be an option in the other drop-down lists. Also, when the form is published, the end user will not use the drop-down lists in order. I have found script to remove selected items, but it only works when the user makes selections in order (List1, List2, List3 etc).
    First time posting, any help would be appreciated.

    Look into the ring control.  It behaves a lot like an enum, but you can dynamically set its contents and values associated with those contents.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How can I restore the search bar drop down list and current search engine icon as it was in FF version 33?

    Is there a way to restore the search bar from version 33?
    I like seeing which search engine I have selected and the ability to change it with a drop down list BEFORE I highlight text, right-click, and select ' Search Google for "xxxx" '
    Any way to roll back this latest "improvement"?

    If you miss being able to switch search engines without going
    crazy with menus, try this out;
    '''[https://addons.mozilla.org/en-US/firefox/addon/context-search/ Context Search]''' {web link}
    Expands the context menu's 'Search for' item into a list of
    installed search engines, allowing you to choose the engine
    you want to use for each search.

  • How to get drop down list  display values

    I have binded my drop down list with tabledataprovider. In the value field i have given customer id and in display field i have given customer name.
    I have reatrived cust id but
    how to reatrieve customer name.

    http://forum.sun.com/jive/thread.jspa?forumID=123&threadID=56515
    Also, if your dropdown list is bound to a data provider you can use something like this:
    RowKey rowkey = tripDataProvider.findFirst("PERSON.PERSONID", dropDown1.getSelected());
    String displayValue = (String)tripDataProvider.getValue("PERSON.NAME", rowkey);

  • Error while populating drop down list with values from a database

    Hi all,
    I have a JSP page with a drop down list that is to be populated with values from a database.
    This is the code in my JSP file:
         <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers();
                Iterator<Integer> iterator = floornumbers.iterator(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% while (iterator.hasNext()) { %>
                       <option value="<%=iterator.next().intValue()%>"> <%=iterator.next().intValue()%> </option>
                       <% } %>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>   The DataManager.java class simply forwards this to its respective Peer class, which has the code shown below:
          package seatplanner.model;
        import java.sql.Connection;
        import java.sql.ResultSet;
        import java.sql.SQLException;
        import java.sql.Statement;
        import java.util.ArrayList;
        /* This class handles all floor operations */
         public class FloorPeer
         /* This method returns all the floor numbers */
         public static ArrayList<Integer> getAllFloorNumbers(DataManager dataManager) {
            ArrayList<Integer> floornumbers = new ArrayList<Integer>();
            Connection connection = dataManager.getConnection();
            if (connection != null) {
              try {
                Statement s = connection.createStatement();
                String sql = "select ID from floor order by ID asc";
                try {
                  ResultSet rs = s.executeQuery(sql);
                  try {
                    while (rs.next()) {
                      floornumbers.add(rs.getInt(1));
                  finally { rs.close(); }
                finally {s.close(); }
              catch (SQLException e) {
                System.out.println("Could not get floor numbers: " + e.getMessage());
              finally {
                dataManager.putConnection(connection);
            return floornumbers;
         }  The classes compile properly, but when I load this page up in Tomcat it just freezes and does not load the form. I tested the DB connection and it works fine.
    What am I doing wrong in the JSP code?
    Thanks for the help in advance.
    UPDATE: I commented out the form, and added <%=floornumbers.size()%> right above the commented code to check if the ArrayList is indeed getting populated with the values from the database (the values are of type integer in the database). The page still freezes like before. I'm puzzled now :confused: .

    Wrong usage of Iterator.
    <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers();
                Iterator<Integer> iterator = floornumbers.iterator(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% while (iterator.hasNext()) {
                                    Integer inte = iterator.next();
                            %>
                       <option value="<%=inte.intValue()%>"><%=inte.intValue()%></option>
                       <% } %>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>or make use of enhanced loop as you are already using J2SE 5.0+ for avoiding confusions.
    <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% for(Integer inte:floornumbers) {%>
                       <option value="<%=inte.intValue()%>"><%=inte.intValue()%></option>
                       <%}%>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>and a lot better thing would be making usage of basic Taglib provided with JSTL spec or struts spec which make life easier and simple.
    something like usage of <c:forEach/> or <logic:iterate/> would be lot better without writing a single scriptlet code.
    Hope that might help :)
    REGARDS,
    RaHuL

  • Dynamic Drop-down list - selected value can't be cleared ...

    1. check out the following code of a dynamic drop down list using cursor :-
    DECLARE
         -- DROP-DOWN LIST OF ALL DEPARTMENTS
         TEMPNUMBER NUMBER(2) := 2 ;
    -- Because we've to initialize the list
    -- at least with 1 item.
    CURSOR C_DEPT IS
         SELECT DEPT_ID FROM DEPARTMENT;
    BEGIN
         ABORT_QUERY ;
         CLEAR_LIST('DEPTLIST');
         FOR TEMP IN C_DEPT LOOP
         ADD_LIST_ELEMENT( 'DEPTLIST', TEMPNUMBER, TEMP.DEPT_ID, TEMP.DEPT_ID );
         :SRBLOCK.LST := TEMP.DEPTNO;
         -- prev. line set the newly selected value
         TEMPNUMBER := TEMPNUMBER + 1 ;
         END LOOP;     
    END;
    2. problem is as we've to atleast initialize with one list item... that item can't be cleared with CLEAR_LIST.
    3. how can i actually clear that and still use cursor. because i've searched forum for this thing and found all those code not working ... for my project ...
    4. quick help needed ...

    Hi Omar,
    I have solution for you
    To populating or refreshing the lists you can use
    two procedures:
    One of them - generic, which can be used for all types of list
    Another is specific which contain a SQL statement to retrieve the data for
    particular list.
    1. Specific procedure:
    PROCEDURE GET_DEPARTMENT_LIST
    IS
    sql_stat VARCHAR2(32767);
    ret_code NUMBER;
    BEGIN
    -- SQL Statement for Drop-down List
    -- (must have two columns for label and value - both VARCHAR2)
    sql_stat := ' SELECT DEPARTMENT_NAME,TO_CHAR(DEPT_ID)'
    ||' FROM SCHEMA.DEPARTMENT';
    POPULATE_MY_LIST('BLOCK.DEPARTMENT_LIST',sql_stat,ret_code);
    END;
    2. Generic procedure:
    PROCEDURE POPULATE_MY_LIST
    (item_name VARCHAR2,
    sql_stat VARCHAR2,
    out_code OUT NUMBER)
    IS
    rg_id RECORDGROUP;
    rg_name VARCHAR2(100);
    ret_code NUMBER;
    item_id ITEM;
    BEGIN
         item_id := FIND_ITEM(item_name);
         IF ID_NULL(item_id) THEN
              out_code := -1;
              RETURN;
         END IF;
         --Creating Record Group with Unique Name
         rg_name := 'RG_'||SUBSTR(item_name,INSTR(item_name,'.',1)+1,LENGTH(item_name));
         --Checking Record Group Name for existance
         rg_id := FIND_GROUP(rg_name);
         --If Group does exist - delete it
         IF NOT ID_NULL(rg_id) THEN
              DELETE_GROUP(rg_id);
         END IF;
         --Creating Record Group
         rg_id := CREATE_GROUP_FROM_QUERY(rg_name,sql_stat);
    ret_code := POPULATE_GROUP(rg_id);
    IF (ret_code <> 0) THEN
         out_code := ret_code;
         RETURN;
    END IF;
    POPULATE_LIST(item_name,rg_id);
    IF NOT FORM_SUCCESS THEN
         out_code := -2;
         RETURN;
    ELSE
    out_code := 0;     
    END IF;
    DELETE_GROUP(rg_id);
    END;
    Hope it help.
    Dmitry

  • Formula that checks drop down list and then sums

    I have a table with a drop down list with two values: '$' and 'Hr' (cell called 'PType').  There is a cell called 'Proposed' that contains numerical data. The table is dynamic and can have more cells inserted via a button within the row.  I have a totals section that I want to total the SUM of 'Proposed' if the value in 'PType' is '$'.  I can't figure out what type of statement will allow me to write this.
    For now, my solution has been a hidden column whose cell simply states:
    if (PType == "$") then
        Proposed
    endif
    Then, in the totals section, I sum this hidden column since a value outside of '$' returns a '0' and won't affect my SUM.
    I am looking for a formula I can write that does this within the totals cell instead of having two cells.
    Thanks,
    Mallard27

    Here's my take on it.
    // form1.page1.subform1.table.footer.SUM::calculate - (JavaScript, client)
    var total = 0;
    for (i=0; i < form1.page1.subform1.table._row.count; i++) {
        if (table.resolveNode("row[" + i + "].Proposed").rawValue) {
            if (table.resolveNode("row[" + i + "].PType").rawValue == "$") {
                total = total + parseFloat(table.resolveNode("row[" + i + "].Proposed").rawValue);
    this.rawValue = parseFloat(total);
    Steve

  • Drop down list for values at parameters forconfigurable product in CRM 2007

    Hi All,
    I want to create configurable service products in CRM 2007 connected with SAP IS-U.
    I uses the simplified product configuration, container approach. Hierarchy, settypes are set.
    Then I created parameters like for example discount, I can set in the WEB UI default value for this parameters, like 5%.
    But I need to have more variables for one parameter.
    For example:
    The agent sells an electricity product to the customer, and wants to configure the product in the sales process, give a discount from 5, 10, 15%.
    This variables 5,10,15% I like to get somehow in a drop down list, that the agent has a choice wich discount he gives.
    Thanks for any answers!
    Gabor

    Patrick,
    In PPOMA, did you check the requester for inheritance?  If the values are maintained at a higher level, is the inhertiance working to the requester level in the org structure?
    Regards, Dean.
    Edit: I just your reply to the previous posting, do you have one set as a default?
    Edited by: Dean Hinson on May 20, 2008 3:27 PM

  • How can I select from drop-down list and jumping to selected subform?

    I using LC Designer ES2 vers 9. Developing XDP. How can I Select from a drop-down list the appropriate selected subform (jumping to the selected subform on the page)?
    drop-down list...A (jump to subform1)
                             B (jump to subform2)
                             C (jump to subform3)
    subform1
    subform2
    subform3
    ....end of form

    Hi,
    you cannot set focus on a subform but on a field, as only interactive objects can be focussed.
    From a dropdowns exit event the script will look this way:
    switch (this.rawValue) {
              case "A" : xfa.host.setFocus("form1.page2.field1"); break;
              case "B" : xfa.host.setFocus("form1.page2.field1"); break;

  • How to open the Drop Down List on the "enter" event?

    I am trying to find a way for the users to see the expanded drop down list options without using their mouse to click on the down-arrow.
    I am able to add script to the "enter" event so when user key-broad-tabbed into the drop down field, the first items of the list shows up:
    dropdown1.selectedIndex = 0
    However, it would be nice if at the same time, they can also see the rest of the options within the drop down expanded.
    Any help/hints would be appreciated
    Thanks in advance
    p

    It would even be nice if the PDF could default with the small arrow already displaying instead of having having to click the field, then click the arrow. I'm just hoping adobe would add this in a future version.

Maybe you are looking for

  • Subtotal at the bottom of each page Reports

    Hi, i have a report group type report and i need display subtotal at the bottom of each page, and in the next page the first row must be the subtotal of the previous page Example: page 1 subtotal page 1 ( 10 ) "sent" page 2 come from page 1 (10) subt

  • Is this an iPhone 3gs bug

    I was playing around with my iPhone today and I press the call button with no phone numbers in the display and it called my last phone number which happened to be a missed call telemarketer's number. I hung up quickly but really it shouldn't have don

  • From report server database how to know reporting services server

    from report server database how to know reporting services server Thanks

  • Viewer TOTAL record count display CRViewer9

    Post Author: niblick CA Forum: General A application written in a previous version of Crystal Reports (7 or 8 ?) displays the TOTAL record count in the viewer (not in the report).  I had to upgrade the reports to version 9 (RDC - CRViewer9) and when

  • Exception Outside Of EJB Code

    Hello, I have a BMP EJB module that is talking with a SYBASE database using the jconn2 driver on the J2EE AS (Sun Java App Server 8). I deployed the module using the deploytool. I also have a stand-alone application that has been compiled with the cl