Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Editable datatable field validation when using datascroller pagination

843844Jul 12 2009 — edited Jul 13 2009
Hi,

Im using tomahawk-1.1.8 and myfaces-api-1.2.6 I have an editable datatable with each rows having the following set of fields

selectBooleanCheckBox , three selectOneMenus , three outputTexts, three inputTexts

There will be close to 200 rows in the table so im using t:dataScroller to paginate the datatable.

The following are my requirements
1 All elements of the form except the selectBooleanCheckbox must be disabled on load of the page.
2 On clicking on the boolean check box the corresponding rows must be enabled.
3 I should be able to extract only the selected row in the bean side to perform some action and finally save it in the database.
4 On submit of the page I should validate the following.
a. at least one check box is selected
b. Whether all the three intputTexts in the row have values and must also verify if they have valid values.
c. Rows which are not selected (using check box) need not be considered for validation
d. if any invalid data is found appropriate error message must be thrown and that particular element should be given the focus

On seeing the requirement I felt it’s better to use Javascript to enable/disable controls and to validate data. Everything works fine if I have all the controls in a single page. But since I have server side pagenation enabled (using datascroller) I’m able to access only the current page form elements from javascript. In shot I’m able to access only the elements which are in the page from where I click on submit.But the user may change data in several pages and finally submit.

This leads me to a situation where validation can be done using JSF only. I’m ok to do validations in JSF using a custom validator .But certain things like enabling or disabling controls on the form and the onLoad behavior can be coded using javascript only. This is because if I set the values such as disabled=”true” on the jsf inputText tag itself it is taking effect every time I move out and come back to the same page.

I’m new to JSF . Can someone assist me in this. It’s pretty URGENT….

Thanks,
Swami
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2009
Added on Jul 12 2009
5 comments
846 views