Question

I have an issue where the value of t:radio (associated with t:selectOneRadio) is not being passed to the backing bean. We are currently converting from JSF 1.x to JSF 2.x, using MyFaces 2.1.13 on Jboss 7.2.0, and we do have the 2.0 version of the Tomahawk library. I have spent hours trying different things to get it to work and searched high and low but can't find anyone else having encountered the same problem. I have determined that the setter is never being called once a value is checked.

I have extracted the code and simplified it, yet still nothing is passed on the ajax call.

<h:form id="profileReport">

    <h:messages />

    <h:panelGrid columns="2">

        <t:selectOneRadio id="selectQuestionnaire" layout="spread" required="true" 
                value="#{viewProfile.selectedQuestionnaire}">
            <f:selectItem itemValue="SC_PRE!20121212095427.0000000.059814626868021525" /> 
            <f:ajax event="click" execute="@this" render="profileReport:selectTemplate profileReport" />    
        </t:selectOneRadio>

        <h:outputLabel for="selectQuestionnaire" value="#{prmsgs.firstQuestionnaireLabel}" styleClass="labelText" />
        <t:radio index="0" for="profileReport:selectQuestionnaire" />

        <h:outputLabel for="selectTemplate" value="#{prmsgs.exploratoryProcessTemplate}:" styleClass="labelText" />
        <h:selectOneListbox id="selectTemplate" value="#{viewProfile.selectedInterpretiveProfileTemplateId}" required="#{menuNavigation.selectInterpretiveProfileActive}">
            <f:selectItems value="#{viewProfile.interpretiveProfileTemplates}"/>
        </h:selectOneListbox>
    </h:panelGrid>
</h:form>

Just for testing purposes, I have replaced the t:selectOneRadio with h:selectOneRadio and the setter is called. Then I tried the t:selectOneRadio without t:radio and that worked. So it appears to be an issue with t:radio, though I'm not sure what it is at this point. I am aware Icefaces has similar functionality, but I don't want to introduce another full component library just for this singular use at this time. We are trying to minimize the changes as much as possible as this is a very lean conversion process.

Was it helpful?

Solution

When t:selectOneRadio layout="spread" is used, t:selectOneRadio is one component and t:radio is another component, even if they work together. In this case, when the ajax request is executed, the lifecycle is executed over t:selectOneRadio but it is not executed for t:radio. f:ajax component cannot be overriden in that way, so it is not possible to include t:radio in the lifecycle once it has started.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top