why do you want to use onclick for submiting? you can use any of the listeners 
in jsf.
btw, returning false in script method will not submit the form.

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, March 17, 2008 1:11 PM
To: 'MyFaces Discussion'
Subject: AW: selectOneListbox onclick - navigation



Noone tried this before?



Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 14. März 2008 13:13
An: [email protected]
Betreff: h:selectOneListbox onclick - navigation



Hi!

I tried to use the onClick Event from selectOneListBox for navigation, but the 
action method get not called:



<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h"%>

<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f"%>

<%@ taglib uri="http://myfaces.apache.org/tomahawk"; prefix="t"%>

<script type="text/javascript">

                  function executeCommandLink(idLink,formName){

                  
document.forms[0].elements[formName+':_link_hidden_'].value=idLink;

            if(document.forms[formName].onsubmit){

                document.forms[formName].onsubmit();

            }

            document.forms[0].submit();

            return false;

                  }

                  </script>

<f:subview id="subViewSelect" rendered="#{mainContrl.renderSelect}">

      <h:form id="fSelect" enctype="UTF-8">

            <h:panelGroup id="selectPG2">

                  <h:selectOneListbox id="selectTransportListTitle"

                        onclick="executeCommandLink('cmdLink1','fSelect')"

                        styleClass="selectList" 
value="#{selectContrl.transportSelected}">

                        <f:converter converterId="transportConverter" />

                        <f:selectItems value="#{selectContrl.transportList}" />

                  </h:selectOneListbox>

            </h:panelGroup>

            <h:commandLink id="cmdLink1" action="#{selectContrl.showDetail}" />

      </h:form>

</f:subview>





<navigation-rule>

            <from-view-id>/jsp/secure/main.jsp</from-view-id>

            <navigation-case>

                  <from-action>#{selectContrl.showDetail}</from-action>

                  <from-outcome>success</from-outcome>

                  <to-view-id>/jsp/secure/detail.jsp</to-view-id>

            </navigation-case>

</navigation-rule>





private static final String SHOW_DETAIL = "success";

      public String showDetail() {

            return SelectController.SHOW_DETAIL;

      }


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com

Reply via email to