« Return to Thread: [jira] Created: (TRINIDAD-1523) Issue with - Implementing dependent select boxes

[jira] Commented: (TRINIDAD-1523) Issue with <tr:selectOneChoice> - Implementing dependent select boxes

by My Faces - Dev mailing list :: Rate this Message:

Reply to Author | View in Thread


    [ https://issues.apache.org/jira/browse/TRINIDAD-1523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12756709#action_12756709 ]

Rafael Gonçalves Sampaio commented on TRINIDAD-1523:
----------------------------------------------------

Hello Borja,
Please note that I did NOT give a SOLUTION to the problem on the selectOneChoice tag... what I did was WORKAROUND for the error posted by Vijay, which, by the way, I've also experienced. If you have other problems wich are not related to the situation reported by Vijay I do Agree with you that my code is not suitable for your needs.
Taking a first look at your code, I could not fully understand your problem, but I'd recommend that you do not generate nested combos with the same ID as you are doing, since if you would reuse my code anyhow, you couldn't get the proper nested combo.
If you whish me to have a closer look at your problem please attach a runnable example w/ source of your problem or post the complete code like Vijay and also the stack trace of the error

Kind Regards

> 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.

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

 « Return to Thread: [jira] Created: (TRINIDAD-1523) Issue with - Implementing dependent select boxes