0 Replies Latest reply on Jan 27, 2010 7:15 AM by Lauri L

    How to access the selected component of a selectOneMenu option?

    Lauri L Newbie

      How can I refer to the selected component of a selectOneMenu? I'd like to pass the selected javax.persistence.Entity ("program") as the parameter to the action call #{programOrder.select(program)}. The code below does not work.

       

          <a4j:form>
              <div class="software_menu caption">
                  <h:outputText value="#{messages.software_name}"/>
              </div>

              <h:selectOneMenu id="software_menu" styleClass="software_menu" required="true">
                  <a4j:support event="onchange" reRender="program_info"/>
                  <s:selectItems value="#{programs}" var="program" label="#{program.programName}"
                                 noSelectionLabel="#{messages.software_select}"/>
                  <s:convertEntity/>
              </h:selectOneMenu>
          </a4j:form>

          <a4j:outputPanel layout="block" styleClass="program_info" id="program_info">       
              <div class="software_cost_and_order">
                  <div class="software_cost" id="cost">
                      <h:outputFormat value="#{messages.price_and_rent_or_onetime}"
                                      rendered="#{rich:findComponent('software_menu').value != null}">
                          <f:param value="#{rich:findComponent('software_menu').value.price.amount }"/>
                      </h:outputFormat>
                  </div>

                  <s:button styleClass="software_select" value="#{messages.place_order}" action="#{programOrder.select(program)}"
                            rendered="#{rich:findComponent('software_menu').value != null}" />
              </div>
          </a4j:outputPanel>

       

      Any advice is appreciated.