[
https://issues.apache.org/jira/browse/TRINIDAD-1523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12745565#action_12745565
]
Rafael Gonçalves Sampaio commented on TRINIDAD-1523:
----------------------------------------------------
Hello Vijay.
I've had the same problem and did a workaround to get it working until some of
the Project gurus solve this issue.
Instead of setting null to the property in the managed bean, you should set
null to the submitted value of the nested component like this:
...
public void processAccountFeatureChange(ValueChangeEvent vce){
//DO YOUR WORK TO POPULATE THE NEW VALUES FOR THE NESTED COMPONENT
UIComponent parent = vce.getComponent().getParent();
CoreSelectOneChoice choice =
(CoreSelectOneChoice)parent.findComponent("selectCardOrCheckType");
if (null != choice)
choice.setSubmittedValue(null);
}
...
This should work for the moment
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.