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 7849039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:24:21+00:00 2026-06-02T18:24:21+00:00

I have jsf datatable populated from backing bean ArrayList. Now I need to compare

  • 0

I have jsf datatable populated from backing bean ArrayList. Now I need to compare values with the values in one column of my table, how can i do this?

my datatable:

<t:dataTable var="tabl"
rowIndexVar="rownum" 
id="data" 
value="#{bean.sortedList}"
>

……….
the column i want to compare data:

<t:column>
    <f:facet name="header">
        <h:commandLink>
            <h:outputText  value="sortedList"/>
        </h:commandLink>
    </f:facet>
     <f:verbatim>&nbsp;</f:verbatim>
    <h:inputText value="#{tabl.numbers}"
                id="numbers">
    </h:inputText>
</t:column>

my table structure:

<tbody id="myForm:data:tbody_element">
<tr>
...
<td>&#160;<input id="myForm:data:0:workAreaNumberU" name="myForm:data:0:workAreaNumberU" type="text" value="0001" size="4" onkeyup="value_altered(0);"></td>
</tr>
....
<tr>
...
<td>&#160;<span id="_idJsp1:data:1:workAreaNumber">0104</span></td>
...
</tr>
</tbody>

finally solved in this way (base on my table structure)

var table = document.getElementById("myForm:data:tbody_element");
var new_wa;
for (var i = 0, row; row = table.rows[i]; i++) {
    var new_wa_box = document.getElementById("myForm:data:" + i + ":workAreaNumberU");
    if( new_wa_box != null ) {
        new_wa = new_wa_box.value;
    }else{
        new_wa_box = document.getElementById("myForm:data:" + i + ":workAreaNumber");
        new_wa = new_wa_box.innerHTML;
        }
    alert("row new_wa_box = "+new_wa);
}
  • 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-06-02T18:24:22+00:00Added an answer on June 2, 2026 at 6:24 pm

    This is not a JSF problem. It’s not different from when using plain HTML. JavaScript doesn’t work with the JSF source code, but with its generated HTML output only (as you can see by rightclick and View Source in browser). Your concrete mistake is that you used element.innerHTML which returns the entire HTML content of the <td> instead of getting the <input> element from the <td> first and then its value attribute.

    This should give you the value of the first <input> element of the <td>, prechecks omitted for brevity:

    var value = col.getElementsByTagName("input")[0].value;
    

    I only wonder the usefulness of doing this all in JavaScript instead of in JSF.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSF 1.2 dataTable using ICEfaces 1.8. In one column, I would
I have a h:commandLink in one of the column in datatable. JSF <h:commandLink id=save
Brief intro about my requirement. I have an empty JSF dataTable. Now, when I
I have an h:dataTable with data generated from an ArrayList with custom object Result.
I currently have a table displayed on one of my jsf pages, bound to
I have jsf page: .... <form jsfc=h:form action=> <h:dataTable value=#{newMusician.strings} var=preferredMusicGenre id=musicGenresSelectTable> <h:column> <h:inputText
I have a JSF page that has a property datatable a.k.a p:dataTable I need
I have a JSF datatable like this one: <h:form id=productsBox> <h:dataTable var=product value=#{categoriesBean.category.products} id=productsTable>
I have a rather silly question, I need to pass a parameter from one
I have a JSF h:datatable with rows of data: <h:dataTable id=dataTable value=#{SessionsController.dataList} binding=#{table} var=item>

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.