First of all.. I know that it was not a solution, and perhaps I did not use the correct word when talking about it. Sorry for that and thank you for your quick answer.
Not using the same id was one of the things that I was looking for, but since the id property does not accept EL (security reasons) I'm not able to set different id's..
There's another fact: the tr:iterator treats everything inside it as a unique component.
e.g. in a concrete case I have three combos, and although when rendering they have different id's (you know, blahbla:0:id, blahblah:1:id, and so on..), when I try to get the source of a ValueChangeEvent, for example, it always returns THE unique id, whether is the first combo or the second or..
So, in this scenario, I'm not able to build dynamic and dependent select boxes, populating the 'child' combo when updating the selected value at the 'parent'. Their values (the options of the combos) are lost somewhere when doing the PPR, and when it tries to restore the index selected before, it throws the IndexOutOfBoundsException..
I'll try to find a way of doing this.. but as I said before, thank you so much. And of course, meanwhile, ideas are accepted.
> Issue with <tr:selectOneChoice> - Implementing dependent select boxes
> ---------------------------------------------------------------------
>
> Key: TRINIDAD-1523
> URL:
https://issues.apache.org/jira/browse/TRINIDAD-1523> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Components
> Affects Versions: 1.2.11-core
> Environment: Windows
> Reporter: Vijay Ramalingam
>
> I am trying to implement dependent select boxes using trinidad. I have 2 drop down box, say A and B. I have set the autoSubmit="true" in dropdown A and specified partialTriggers with dropdwon B. When i change the A drop down B changes, as expected. But when i change any value in B dropdown and again change A. I get the below error.
> java.lang.IndexOutOfBoundsException: SelectOne submittedValue''s index 1 is out of bounds. It should be between 0 and 0
> at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectOneRenderer.__getIndex(SimpleSelectOneRenderer.java:423)
> at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectOneRenderer._convertIndexedSubmittedValue(SimpleSelectOneRenderer.java:214)
> at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectOneRenderer.getConvertedValue(SimpleSelectOneRenderer.java:181)
> at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAndMessageRenderer.getConvertedValue(InputLabelAndMessageRenderer.java:65)
> at org.apache.myfaces.trinidad.component.UIXEditableValue.getConvertedValue(UIXEditableValue.java:422)
> at org.apache.myfaces.trinidad.component.UIXEditableValue.validate(UIXEditableValue.java:164)
> at org.apache.myfaces.trinidad.component.UIXEditableValue._executeValidate(UIXEditableValue.java:488)
> at org.apache.myfaces.trinidad.component.UIXEditableValue.processValidators(UIXEditableValue.java:270)
> at javax.faces.component.UIForm.processValidators(UIForm.java:74)
> at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:709)
> at javax.faces.component.UIViewRoot.access$101(UIViewRoot.java:43)
> at javax.faces.component.UIViewRoot$2.process(UIViewRoot.java:97)
> at javax.faces.component.UIViewRoot.process(UIViewRoot.java:206)
> at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:93)
> at org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:32)
> at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
> at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:148)
> at arch.jsf.JsfResource.process(JsfResource.java:145)
> at arch.presentation.beans.WebApplication._doServletFilterForRequest(WebApplication.java:564)
> at arch.presentation.beans.WebApplication.processResource(WebApplication.java:1368)
> at arch.presentation.beans.WebApplication.processRequest(WebApplication.java:2531)
> at arch.service.beans.ServiceContainer.processRequest(ServiceContainer.java:3913)
> at arch.no.engine.Context.processRequest(Context.java:68)
> at arch.no.engine.HttpConnector.processRequest(HttpConnector.java:58)
> at arch.no.http.Response.prepare(Response.java:563)
> at arch.no.http.Response._execute(Response.java:1975)
> at arch.no.http.Response.execute(Response.java:1910)
> at arch.no.http.HttpThreadPool._run(HttpThreadPool.java:32)
> at arch.util.ThreadPool._runLoopBody(ThreadPool.java:215)
> at arch.util.ThreadPool._runForThread(ThreadPool.java:232)
> at arch.util.ThreadPool.access$000(ThreadPool.java:5)
> at arch.util.ThreadPool$1.run(ThreadPool.java:97)
> Please find my XHTML content
> ------------------------------------------
> <f:view>
> <h:form id="dropDownForm">
> <tr:selectOneChoice valueChangeListener="#{dropdownbean.processAccountFeatureChange}" binding="#{dropdownbean.selectAccountFeature}" autoSubmit="true" value="#{dropdownbean.accountFeature}" id="selectAccountFeature" size="1">
> <f:selectItems value="#{dropdownbean.accountFeatureMap}" />
> </tr:selectOneChoice>
> <tr:selectOneChoice binding="#{dropdownbean.selectCardOrCheckType}" partialTriggers="selectAccountFeature" value="#{dropdownbean.cardOrCheckType}" id="selectCardOrCheckType" size="1">
> <f:selectItems value="#{dropdownbean.checkTypeMap}" />
> </tr:selectOneChoice>
> </h:form>
> </f:view>
> Please find my Bean code
> ------------------------------------
> public class DropDownBean {
> CoreSelectOneChoice selectAccountFeature;
>
> CoreSelectOneChoice selectCardOrCheckType;
>
> String accountFeature="1";
>
> String cardOrCheckType="SCO";
>
> Map accountFeatureMap;
>
> Map checkTypeMap;
> public DropDownBean(){
> super();
> AMAConfig amaConfig = new AMAConfig();
> accountFeatureMap = amaConfig.getAcctFeatureMap();
> checkTypeMap = amaConfig.getSilverLevelCheckTypeMap();
> }
>
> public void setSelectAccountFeature(CoreSelectOneChoice selectAccountFeature){
> this.selectAccountFeature = selectAccountFeature;
> }
> public CoreSelectOneChoice getSelectAccountFeature(){
> return this.selectAccountFeature;
> }
>
> public void setSelectCardOrCheckType(CoreSelectOneChoice selectCardOrCheckType){
> this.selectCardOrCheckType = selectCardOrCheckType;
> }
> public CoreSelectOneChoice getSelectCardOrCheckType(){
> return this.selectCardOrCheckType;
> }
>
> public String getAccountFeature(){
> return this.accountFeature;
> }
> public void setAccountFeature(String accountFeature){
> this.accountFeature = accountFeature;
>
>
> AMAConfig amaConfig = (AMAConfig)getValue("#{amaConfig}", AMAConfig.class);
>
> if("1".equals(accountFeature)){
> this.cardOrCheckType = "SCO";
> checkTypeMap = amaConfig.getSilverLevelCheckTypeMap();
> }else if("2".equals(accountFeature)){
> this.cardOrCheckType = "GCC";
> checkTypeMap = amaConfig.getGoldLevelCheckTypeMap();
> }else {
> this.cardOrCheckType = "PCC";
> checkTypeMap = amaConfig.getPlatinumLevelCheckTypeMap();
> }
> }
>
> public void setCardOrCheckType(String cardOrCheckType){
> this.cardOrCheckType = cardOrCheckType;
> }
> public String getCardOrCheckType(){
> return this.cardOrCheckType;
> }
>
> public Map getAccountFeatureMap(){
> return this.accountFeatureMap;
> }
>
> public Map getCheckTypeMap(){
> return this.checkTypeMap;
> }
>
> public void processAccountFeatureChange(ValueChangeEvent vce){
> System.out.println("\nprocessAccountFeatureChange\n");
> selectCardOrCheckType.setValue(null);
> }
> }
> I declared my bean as
> <managed-bean>
> <managed-bean-name>dropdownbean</managed-bean-name>
> <managed-bean-class>DropDownBean</managed-bean-class>
> <managed-bean-scope>request</managed-bean-scope>
> </managed-bean>
> Please help me.