Skip to main content

2nd value change listener won't fire

2 replies [Last post]
Joined: 2010-01-26

I've got three selectonemenus, the first is enabled and you can
select a sport, the other two are initially disabled. When selected
the 2nd menu is enabled and you can select a club, which when
selected should enable the third field allowing you to select a squad.

The problem is that the 2nd field gets enabled as expected but
not the third. The mechanism used is exactly the same in both
cases, i.e. to use a valuechangelistener with ajax. Here's the code:

<br />
#{msgs.sportLabel} </p>
<p>                    #{msgs.clubLabel} </p>
<p>                    #{msgs.squadLabel} </p>

and from the clubView backing bean:

<br />
private HtmlSelectOneMenu inputClub, inputSquad;</p>
<p>public void enableInputClub(ValueChangeEvent vce) {<br />
        if (getInputClub().isDisabled() == true) {<br />
            getInputClub().setDisabled(false);<br />
        }<br />
<p>public void enableInputSquad(ValueChangeEvent vce) {<br />
        if (getInputSquad().isDisabled() == true) {<br />
            getInputSquad().setDisabled(false);<br />
        }<br />
    }<br />

so I've got three components with ids sport (enabled), club (disabled)
and squad (disabled). I select a sport and the "club" component is enabled
by the VCL and re-rendered via ajax. It works fine. I then select a club but
the "squad" selectonemenu component remains disabled because the
enableInputSquad() VCL never fires.

Now I may be suffering from code blindness but I can't see what the difference
is between the first enable and the second. I don't think there is any difference.

If anyone knows any way to do an enable that actually works I'd love to hear
from you as this has been another wasted day.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-05-06

Thanks for providing the detail for this issue. It will help when trying to reproduce the problem.

Joined: 2010-01-26

I've spent all day fighting dirty trying to get this working but will have to give
up and move on now. It doesn't matter what I do, the 2nd selectOneMenu
component is like a black hole, what goes in doesn't come out. It makes
no difference whether components are enabled or disabled, the VCL on the
2nd selectOneMenu never fires and neither will a setter on the value=
property (if present). I tried using PrimeFaces p:ajax (in place of f:ajax) which
allows both an action and actionListener but neither will fire.

The only option really is to have the third selectOneMenu on a separate
page (assuming this actually works), but that would mean I've only got two
combos on one page, not exactly cramming too much in the space.

I'm using the latest Mojarra night build 2.0.3 last updated Jun 12. If anyone
can suggest any sort of workaround I'll try it straight away.