Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6968285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:25:56+00:00 2026-05-27T16:25:56+00:00

I have a trinidad table with one column contains drop downs (select one choice)

  • 0

I have a trinidad table with one column contains drop downs (select one choice) for each row and another column contains an input text for each row.

When a particular option is selected, the input becomes editable (else it remains read only).

The read only behaviour and the partial event are working perfectly as expected. The problem is whenever the input text is supposed to move from editable to read only, I still see the value previously entered when the input text was editable.

From here if I select another option (for which the input text would also be read only) the value goes away.

The JSP Code is as follows:

<tr:table emptyText="No Data" var="vo" autoSubmit="true" partialTriggers="accountType"     value="#{testingBean.voList}" binding="#{testingBean.table}" width="50%">
<tr:column>
    <f:facet name="header">
        <tr:outputText value="Sl No" />
    </f:facet>
    <tr:outputText value="#{vo.slNo}" />
</tr:column>
<tr:column>
    <f:facet name="header">
        <tr:outputText value="Account Type" />
    </f:facet>
    <tr:selectOneChoice unselectedLabel="Select" id="accountType" value="#{vo.accountType}" 
        autoSubmit="true" immediate="true" valuePassThru="true"
        valueChangeListener="#{testingAction.optionsChanged}">
        <f:selectItems value="#{testingBean.options}" />
    </tr:selectOneChoice>
</tr:column>
<tr:column>
    <f:facet name="header">
        <tr:outputText value="Other" />
    </f:facet>
    <tr:inputText value="#{vo.otherType}"
        partialTriggers="accountType"
        readOnly="#{vo.readOnlyFlag}"></tr:inputText>
</tr:column>
</tr:table>

The code for the valueChangeListener is as follows:

public void optionsChanged(ValueChangeEvent vce) {
    try {
        System.out.println("Inside Method");
        testingBean = (TestingBean) FacesContext.getCurrentInstance()
                .getExternalContext().getSessionMap().get("testingBean");
        ArrayList<TableRowVO> list = testingBean.getVoList();
        UIXTable table = testingBean.getTable();
        TableRowVO vo = list.get(table.getRowIndex());
        vo.setReadOnlyFlag(true);
        vo.setAccountType(vce.getNewValue().toString());
        vo.setOtherType("");
        if (vce.getNewValue().equals("3")) {
            System.out.println("Setting false");
            vo.setReadOnlyFlag(false);
        }
        list.set(table.getRowIndex(), vo);
        table.setValue(list);
        testingBean.setVoList(list);
        FacesContext.getCurrentInstance().getExternalContext()
                .getSessionMap().put("testingBean", testingBean);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

Is this behaviour expected? Or is there a workaround?

Interestingly, the “View Page Source” option in Firefox does not contain the text, even though I can see it on the page. I had to use FireBug to analyze the element which revealed the following:

<div class="af_inputText_content" 
id="j_id_jsp_545172797_17:0:j_id_jsp_545172797_27">
tttt
</div>

Version used:
Trinidad 2.x
JSF 2.x
Tomcat 7.0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:25:57+00:00Added an answer on May 27, 2026 at 4:25 pm

    Ok, so I got it to work a while back but forgot to post the answer….

    I used FacesContext to find the CoreComponent for the input text and then reset the components value.

    Basically:

    1. Find the CoreTable object
    2. Find the CoreColumn object
    3. Find the CoreInputText object
    4. Reset the value for CoreInputText

    The Modified JSP Code is as follows:

    <tr:table emptyText="No Data" var="vo" autoSubmit="true" partialTriggers="accountType" id="voTable" value="#{testingBean.voList}" binding="#{testingBean.table}" width="50%">
        <tr:column id="slNoCol">
            <f:facet name="header">
                <tr:outputText id="slNoHdr" value="Sl No" />
            </f:facet>
            <tr:outputText id="slNo" value="#{vo.slNo}" />
        </tr:column>
        <tr:column id="accountTypeCol">
            <f:facet name="header">
                <tr:outputText id="accountTypeHdr" value="Account Type" />
            </f:facet>
            <tr:selectOneChoice unselectedLabel="Select" id="accountType" value="#{vo.accountType}" autoSubmit="true" immediate="true" valuePassThru="true"  valueChangeListener="#{testingAction.optionsChanged}">
                <f:selectItems value="#{testingBean.options}" />
            </tr:selectOneChoice>
        </tr:column>
        <tr:column id="otherTypeCol">
            <f:facet name="header">
                <tr:outputText id="otherTypeHdr" value="Other" />
            </f:facet>
            <tr:inputText value="#{vo.otherType}" columns="15" partialTriggers="accountType" id="otherType" readOnly="#{vo.readOnlyFlag}" immediate="true">
            </tr:inputText>
        </tr:column>
    </tr:table>
    

    The code for the modified valueChangeListener is as follows:

    public void optionsChanged(ValueChangeEvent vce) {
        try {
            testingBean = (TestingBean) FacesContext.getCurrentInstance()
                    .getExternalContext().getSessionMap().get("testingBean");
            ArrayList<TableRowVO> list = testingBean.getVoList();
    
            CoreTable table = (CoreTable) FacesContext.getCurrentInstance()
                    .getViewRoot().findComponent("voTable");
            CoreColumn column = (CoreColumn) table
                    .findComponent("otherTypeCol");
            CoreInputText text = (CoreInputText) column
                    .findComponent("otherType");
            text.setValue("");//This is the trick....
            TableRowVO vo = list.get(table.getRowIndex());
            vo.setReadOnlyFlag(true);
            vo.setAccountType(vce.getNewValue().toString());
            vo.setOtherType("");
            if (vce.getNewValue().equals("3")) {
                vo.setReadOnlyFlag(false);
            }
            list.set(table.getRowIndex(), vo);
            table.setValue(list);
            testingBean.setVoList(list);
            FacesContext.getCurrentInstance().getExternalContext()
                    .getSessionMap().put("testingBean", testingBean);
    
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple requirement: The number of columns of my <tr:table/> is dynamic.
Hi I have followed the setup guide at: http://myfaces.apache.org/trinidad/installation.html When I include the following
Have any one tried to activate fancybox thumbnail gallery using a button or an
have the following text file: <div> <asp:HyperLinkField HeaderText=Hello World of Regular Expression /> </div>
The Issue: We have a Java web application, based on Apache MyFaces Trinidad. We
Have an app that can use tts to read text messages. It can also
have Googled the cr*p out of this one so apologies if the answer is
Have a look at one of my websites: moskah.com The problem is that it
Have posting working wonderfully, and reading the response happily EXCEPT when one of the
I have a Problem with the Apache Trinidad tr:panelTabbed component. I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.