Hello,

Before describing my problem, I need to disclose that I am new to Trinidad,
therefore it is entirely possible I am missing something obvious.

I am using Trinidad 1.2.3, deploying on GlassFish 2.

I am trying to update the options in one <tr:selectOneOption> when the value
of another <tr:selectOneOption> changes. Based on what I read at
http://myfaces.apache.org/trinidad/devguide/ppr.html#autoSubmit, this should
be fairly simple:
set autoSubmit="true" on the first <tr:selectOneOption>, bind its
valueChangeListener property to a method to be executed when the value of
the component changes, and set the partialTriggers property of the second
<tr:selectOneOption> to the id of the first one.

I attempted this procedure to no avail, I don't think the first
<tr:selectOneOption> is triggering a partial submit at all. I Googled around
and found some example code in the archives for this list:
http://www.mail-archive.com/users@myfaces.apache.org/msg43646.html

The code shown in this message was very similar to what I had, but since
mine wasn't working and this one allegedly was, I pretty much copied and
pasted both the JSP and the backing bean code, but unfortunately it still
didn't work.

The two <tr:selectOneChoice> tags look like this:

<tr:selectOneChoice label="Select one:"
                              required="true"
                              requiredMessageDetail="You must select one"
                              unselectedLabel="Select one..."
                              value="#{testBean.firstSelection}"
                              readOnly="false"
                              valueChangeListener="#{
testBean.selectionChange}"
                              autoSubmit="true"
                              id="firstSelection"
                              immediate="true">
            <f:selectItems value="#{testBean.firstList}" id="selectItems1"
/>
          </tr:selectOneChoice>

          <tr:selectOneChoice  id="selectOneChoice2"
                               label="Select:"
                               unselectedLabel="Select another one..."
                               value="#{testBean.secondSelection}"
                               rendered="true"
                               partialTriggers="firstSelection">
            <f:selectItems value="#{testBean.secondList}" id="selectItems2"
/>
          </tr:selectOneChoice>

The selectionChange() method on the backing bean looks like this:

public void selectionChange(ValueChangeEvent event)
  {
    String value = (String) event.getNewValue();
    if (value.equals("a"))
    {
      secondList = Arrays.asList(new SelectItem("apple"));
    }
    else if (value.equals("b"))
    {
      secondList = Arrays.asList(new SelectItem("blue"));
    }
  }

FWIW, the backing bean has a scope of session.

Any idea of what I am doing wrong?

Thanks in advance for any help,
David
-- 
http://ensode.net - A Guide to Java, Linux and Other Technology Topics
http://java-ee-5-glassfish.packtpub.com/ - Java EE 5 Development Using
GlassFish Application Server
http://jasperreportsbook.packtpub.com - JasperReports For Java Developers

Reply via email to