PPR doesn't work correctly with tr:inputListOfValues updating a 
tr:selectOneChoice
----------------------------------------------------------------------------------

                 Key: TRINIDAD-1517
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1517
             Project: MyFaces Trinidad
          Issue Type: Bug
    Affects Versions: 1.0.10-core, 1.0.7-core
         Environment: Windows XP, IE6/IE7, Firefox3, Safari 4, OC4J 10.1.3.1.0, 
Trinidad 1.0.7-1.0.10
            Reporter: Mark van den Boomen


There is some weird PPR behaviour when updating a tr:selectOneChoice with a PPR 
event caused by a tr:inputListOfValues, the problem is that the 
tr:selectOneChoice's value doesn't get updated. See the code sample below:

JSP:
        <tr:form>
            <tr:inputListOfValues id="testLov" 
                                      value="#{test.myString}"
                                      immediate="true"
                                      autoSubmit="false"
                                      action="#{test.testLov}"
                                      />
            <tr:panelGroupLayout layout="horizontal">
                <tr:selectOneChoice id="poplist" value="#{test.myString}" 
readOnly="false" partialTriggers="testLov">
                    <f:selectItem itemLabel="Germany" itemValue="de"/>
                    <f:selectItem itemLabel="Netherlands, the" itemValue="nl"/>
                    <f:selectItem itemLabel="United Kingdom" itemValue="uk"/>
                </tr:selectOneChoice>
                <tr:outputText id="txtbox" value="#{test.myString}" 
partialTriggers="testLov" />
            </tr:panelGroupLayout>
        </tr:form>

Bean:
    public class Test {
        private String myString;

        public String testLov(){
            CoreInputListOfValues lovComponent;
            FacesContext context = FacesContext.getCurrentInstance();
            UIViewRoot vr = context.getViewRoot();
            lovComponent = (CoreInputListOfValues)vr.findComponent("testLov");
            String value = (String)lovComponent.getValue();
            
            this.myString = value;
            return null;
        }
        public void setMyString(String myString) {
            this.myString = myString;
        }

        public String getMyString() {
            return myString;
        }
    }

Steps to reproduce:
 1. type value 'nl' in the tr:inputListOfValues
 2. click on the flashlight-icon to trigger the action (action should set the 
value of the bean property)
 3. the tr:selectOneChoice is not updated to the new value. The tr:outputText 
is updated correctly.

Also notice that if you replace the tr:inputListOfValues with some other 
component like a tr:inputText with autosubmit enabled that the 
tr:selectOneChoice will update correctly.

The workaround I found was to force the viewroot to refresh itself and forget 
the state in the action method of the tr:inputListOfValues:

        /* Force page refresh */
        String currentView = vr.getViewId();
        ViewHandler vh = context.getApplication().getViewHandler();
        UIViewRoot x = vh.createView(context, currentView);
        x.setViewId(currentView);
        context.setViewRoot(x);

But I still don't think this is the behaviour it should be.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to