2 Replies Latest reply on Sep 2, 2008 10:45 AM by mgvarley

    a4j:support with h:selectOneMenu - works in IE, not in Firef

    mgvarley

      Hi all - I am having some problems with my search form and I think I have the narrowed the problem down to my use of the a4j:support tag. The action of my form is quite simple - display a dropdown list of countries as an h:selectOneMenu, user selects country, dropdown list of destinations is dynamically populated via an Ajax call to the session managed backing bean, user selects destination - clicks button and results (in this case vendors) matching the destination are displayed. (see code below)

      This works absolutely fine with IE but with Firefox and Safari the value of the "destination" input is not being passed to the server the first time. However, once the empty results table is displayed along with the search controls and I try again it works. I have spent many hours debugging and scouring the web and still have no solution. If anyone has any idea what may be causing this I would be eternally grateful.

      I am developing in Netbeans 6.1 with JDK1.6, JSF1.2 (Sun), RichFaces 3.2.1, IE 7.0, Firefox 3.0.1, Safari 3.1.2.

      Thanks,

      mark

       private UIInput destinationInput;
       private UIInput countryInput;
      
       //...
      
       public void countryChanged(ActionEvent event) {
       getDestinationInput().resetValue();
       fillDestinations();
       }
      
       public void searchVendors(ActionEvent event) {
       try {
       setResults(vendorDAO.listByDestination(destinationID));
       } catch (Exception e) {
       System.out.println(e.getMessage());
       }
       }
      
      
       <rich:calendar id="arrivalDate" popup="true" boundaryDatesMode="scroll" value="#{searchBarBacking.arrivalDate}"/>
      
       <h:selectOneMenu id="country" binding="#{searchBarBacking.countryInput}">
       <f:selectItem itemValue="Select a country...."/>
       <f:selectItems value="#{destinationsBacking.countries}"/>
       <a4j:support event="onchange" actionListener="#{searchBarBacking.countryChanged}" reRender="destination" ajaxSingle="true"/>
       </h:selectOneMenu>
      
       <h:selectOneMenu id="destination" binding="#{searchBarBacking.destinationInput}">
       <f:selectItem itemValue="Select a destination...."/>
       <f:selectItems value="#{searchBarBacking.destinations}"/>
       </h:selectOneMenu>
      
       <h:commandButton value="#{msgs.header_button01}!" actionListener="#{searchBarBacking.searchVendors}" action="results"/>
      





        • 1. Re: a4j:support with h:selectOneMenu - works in IE, not in F
          ilya_shaikovsky

          1) try to add phasetracker to your application

          • 2. Re: a4j:support with h:selectOneMenu - works in IE, not in F
            mgvarley

            Thanks for the tip Ilya. I installed the PhaseTracker as advised and I can now see the cause of the problem. However, I'm not sure how to go about fixing it! In IE, my destinations are returned AFTER UPDATE_MODEL_VALUES 4 however in Firefox they are not returned until BEFORE RENDER_RESPONSE 6.

            Does anyone have any idea how I force my application to render the destination list earlier so the data is correctly bound to my h:selectOneMenu?

            Thanks,

            mark


            Firefox

            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE RESTORE_VIEW 1
            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker afterPhase
            INFO: AFTER RESTORE_VIEW 1
            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE APPLY_REQUEST_VALUES 2
            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker afterPhase
            Processing countryChanged actions
            INFO: AFTER APPLY_REQUEST_VALUES 2
            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE PROCESS_VALIDATIONS 3
            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker afterPhase
            INFO: AFTER PROCESS_VALIDATIONS 3
            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE UPDATE_MODEL_VALUES 4
            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker afterPhase
            INFO: AFTER UPDATE_MODEL_VALUES 4
            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE INVOKE_APPLICATION 5
            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker afterPhase
            INFO: AFTER INVOKE_APPLICATION 5
            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE RENDER_RESPONSE 6
            Returning destinations
            Returning destinations
            02-Sep-2008 16:37:57 org.exadel.jsf.PhaseTracker afterPhase
            INFO: AFTER RENDER_RESPONSE 6
            
            
            Internet Explorer
            
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE RESTORE_VIEW 1
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker afterPhase
            INFO: AFTER RESTORE_VIEW 1
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE APPLY_REQUEST_VALUES 2
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker afterPhase
            INFO: AFTER APPLY_REQUEST_VALUES 2
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE PROCESS_VALIDATIONS 3
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker afterPhase
            INFO: AFTER PROCESS_VALIDATIONS 3
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE UPDATE_MODEL_VALUES 4
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker afterPhase
            INFO: AFTER UPDATE_MODEL_VALUES 4
            Processing countryChanged actions
            Returning destinations
            Returning destinations
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE INVOKE_APPLICATION 5
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker afterPhase
            INFO: AFTER INVOKE_APPLICATION 5
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker beforePhase
            INFO: BEFORE RENDER_RESPONSE 6
            02-Sep-2008 16:39:00 org.exadel.jsf.PhaseTracker afterPhase
            INFO: AFTER RENDER_RESPONSE 6