This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JSF and the fly likes display error in datatable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "display error in datatable" Watch "display error in datatable" New topic
Author

display error in datatable

sonia khetarpal
Greenhorn

Joined: Sep 14, 2006
Posts: 12
I want to display the error messages inside the datatable just alongside its editable inputtext fields. I can do this if I use the required=true in jsf but
i have different actions to be performed for this datatable ie.
1. save -just save the data w/o performing validation for required fields
2. next - perform required field validation and save data

how can i do this?
[ January 17, 2007: Message edited by: Bear Bibeault ]
Andres Quinones
Ranch Hand

Joined: Oct 09, 2006
Posts: 57
Originally posted by sonia khetarpal:
I want to display the error messages inside the datatable just alongside its editable inputtext fields. I can do this if I use the required=true in jsf but
i have different actions to be performed for this datatable ie.
1. save -just save the data w/o performing validation for required fields
2. next - perform required field validation and save data

how can i do this?


Hi Sonia, I think that one possible solution is to add a String field to the class that has each element of your table. So when you validate each position of the list that is the value for the table you can fill that property and when the table is rerendered the validation message could be there an the user can read it.
Don�t forget to put an outputText so you can show this property.

Another solution is to create a list with the same size of the list that has the value of the table. There you can have Strings with the error for each row. So with the modelIndex of the table you can get each position of the error list to render it in the row of the table.

I hope this helps.

[ January 17, 2007: Message edited by: Andres Quinones ]
[ January 17, 2007: Message edited by: Andres Quinones ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56192
    
  13

Please refrain from posting in all uppercase. I have changed your title for you.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: display error in datatable
 
Similar Threads
jsf datatable
JSF Error Messages
Conditional Validation Determined By Which Button Was Clicked
Isolating business layer from presentation
How to save each row in a datatable ?