coded in opera M2;) so code is not checked, but should work;)
or at least demonstrate the idea "1":
===========view============
<script language="javascript">
function comboChanged(){
document.getElementById("f:hiddenButton").click();
}
</script>
<h: form id="f">
<h:commandbutton value="hidden button" action="#{bean.action}"
style="display:none" id="hiddenButton"/>
<h:selectonemenu value=#{bean.selectedComboValue}
onchange="comboChanged()">
<f:selectItems value="#{bean.comboValues}"/>
</h:selectonemenu />
</h:form>
==========model===========
public class bean{
private String selectedComboValue;
private SelectItem[] comboValues;
public string action(){
//check value of selectedComboValue, do sth, return string
depended on
on that value
}
//getters & setters
}
Hi,
I am strugling with the same issue, and am of course pleased to see
that it can be solved :-)
My only problem is that I can't follow the idea schetched here, are
you able to provide a code example?
In my case I also need to suply an <f:param> for the page I am
navigating to, but I suspect I will be able to resolve that in the
action of the hidden button?
Thanks in advance
madsph
On 4/21/05, Heath Borders <[EMAIL PROTECTED]> wrote:
We are doing concept _1_, and its working well for us.
On 4/21/05, Slawek <[EMAIL PROTECTED]> wrote:
> i have 2 concepts:
>
> //-----1-------------------
> u can put invisivle command button:
> to do this jus add style paramter with value
> dispalay:none
> or
> visibility:hidden
> (i cant remeber which is better)
> action of that button can determine selected value...
>
> u can add onchange="comboboxChanged()" parmaterer to your combobox.
> comboboxChanged() is javascript function that "clicks" your invisible
> button.
> action binded to that button can determine value of combox and for
example
> return somme string that will be maped to view...
>
> //-----2-------------------------
> u can put three (or whatever u need) invisble buttons. each of them
has
> action that finally leads to desired view.
> that time your JS function must determine selection and "click" one
of
> invisble buttones (depending on selection)
> //============================
>
> summary:
> first method check selection on server but secod do that on client
> problem:
> when user drop down list and choose the _same_ value than nothing
> happends:/
> u cant add onclick attrib cause it will be fired wher user drop down
list
> (before choose value)-what a shyt;)
>
> choose whatever matches your philosophy or sth;)
>
> cheers
>
> Sławek
>
> > Hi,
> >
> > How to navigate to some other page by just selecting one value
from a
> > drop down menu in JSF?
> > I mean you shd nt use the submit or link.
> > suppose there are 3 values in the drop down.
> > Now, depending on whatever you select , it should go to different
page.
> > say, if i select first value, it shd go to first.jsp.
> > if i select second value then it shd go to second.jsp and so on.
> >
> > I am able to do this by using submit button but i am not able to
do this
> > without the button.
> >
> > the moment u select some value from the dropdown , some other jsp
page
> > shd come up depending on the value selected by the user.
> >
> > I am using JSF on WebSphere.
> >
> > Plz help guys.
> >
> > Thanx in Advance
> > Sunil
>
>
--
-Heath Borders-Wing
[EMAIL PROTECTED]