Andrew,

entryBean is indeed in request scope.  Indeed, entryBean.subProjects is always 
null, and I suspected this was related to the 'disabled' attribute. Thus my 
question is: how can I set the proper value before the decoding is done? When 
should that be performed?

Thanks for your help

Jean-Noel

On 15 Feb 2010, at 19:03, Andrew Robinson wrote:

> What scope is entryBean?
> 
> If entryBean is requestScope, then entryBean.subProjects will be null
> on each request and would need to be set before the decoding is done,
> otherwise the 2nd choice will never decode as it will be disabled. If
> entryBean is not requestScope than you also have a problem as you
> cannot use component binding with non-request scoped objects.
> 
> -Andrew
> 
> On Sun, Feb 14, 2010 at 8:32 AM, Jean-Noël Colin <[email protected]> wrote:
>> Hi
>> 
>> I need to write a simple page with 2 selectOneChoice components, the second 
>> being dependent on the first. This means that the second should be disabled 
>> as long as a correct value in the first one has not been selected. Also, the 
>> items in the second need to be dynamically loaded depending on the content 
>> on the first one.
>> 
>> I guess this should be easily feasible in Trinidad, but obviously, I must be 
>> missing something because I can't get it to work. it seems that the value of 
>> the second component never gets properly populated in the bean entry. Also, 
>> strangely, in the 'valuechangelistener', the oldvalue is always null, even 
>> when a proper value was correctly selected.
>> 
>> Also, is it possible to avoid the presence of a 'empty' selectItem by 
>> auto-selecting the first valid entry (how can I do that)?
>> 
>> Thanks a lot for your help
>> 
>> Jean-Noel Colin
>> 
>> 
>> 
>> 
>>                                <tr:selectOneChoice id="project" 
>> label="project"
>>                                        binding="#{entryBean.projectSelector}"
>>                                        
>> value="#{entryBean.currentLine.projectId}" showRequired="true"
>>                                        autoSubmit="true" 
>> unselectedLabel="Select" immediate="true"
>>                                        
>> valueChangeListener="#{entryBean.projectChangeListener}">
>>                                        <f:selectItems 
>> value="#{globalData.activeprojects}" />
>>                                </tr:selectOneChoice>
>>                                <tr:selectOneChoice id="subproject" 
>> label="sub-project"
>>                                        partialTriggers="project" 
>> binding="#{entryBean.subProjectSelector}"
>>                                        
>> value="#{entryBean.currentLine.subProjectId}" showRequired="true"
>>                                        unselectedLabel="Select" 
>> disabled="#{empty entryBean.subProjects}">
>>                                        <f:selectItems 
>> value="#{entryBean.subProjects}" />
>>                                </tr:selectOneChoice>
>> 
>> 

Reply via email to