Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!

Tammy Easterby

Greenhorn
+ Follow
since Jan 31, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tammy Easterby

I tried itemDisabled="false", and I still get the error.

Does anyone else know how to fix?
15 years ago
JSF
Hi all,

I have a data table with radio buttons in the last column.

The value it's bound to is an Integer.
The selectItems list is Integer, String.

I sometimes get a conversion error. So I wrote a custom converter.

Got the program to fail again, but this time I'm getting Validation Error: Value is not valid

The value the radio buttons gets bound to is set before the radio buttons themselves, so there's really no reason for the validation error. And yet, here's the error, and nothing is selected as a default.

HELP!
15 years ago
JSF
Hello Abiodun, thanks for responding.
I see you are using itemDisabled. I don't understand its use. What is it for?
15 years ago
JSF
Does anyone have an idea why a select one menu would ever be validated? And how do you get around the validation? Or better yet - what would be failing? It's string key, string value. I don't get it. Please help.
15 years ago
JSF
Varun or Rehana,

I'm having a similar issue... perhaps the same issue... I have a data table. I have radio buttons in that data table. That radio is bound to a field in a backing bean, which is SET when the page loads, which should automatically set that radio to CHECKED. When I submit the form, and try to come back to the page via a link, even though I have the field set to a value, it comes back with a validation error which makes that radio button not get checked.

Can you help me?

- Tammy
15 years ago
JSF
For any Sheriffs out there reading this, I agree with Wilson. We want - no, we *need* - a Head First JSF! :-)
[ April 26, 2007: Message edited by: Tammy Easterby ]
15 years ago
JSF
Also check to see what time zone the IDE thinks it's using.
15 years ago
JSF
It's probably not your code at all. Whatever IDE you're using, you probably need to import a Daylight Saving Time Update for that IDE.
15 years ago
JSF
I'm responding to my own topic, in case anyone else has the same question:
--------------------------------------------------------------------------

What you have to do is this:
1 - Create a converter. In that converter, you go:

HtmlDataTable table = (HtmlDataTable) component.getParent().getParent();
- where component is the UIComponent argument that was passed in.

Then, you go:

List col = table.getChildren();
for (int i = 0; i < col.size(); i++) {
if (col != null) {
List col1 = ((UIColumn) col.get(i)).getChildren();
for (int k = 0; k < col1.size(); k++) {
if (col1 != null) {
try {

- Here is where you put your logic. If some condition is met, then you put a highlight. If not, then the background is white, or gray or whatever the default color for your page is.

And this is how you set the color:

((HtmlOutputText) col1.get(k)).setStyle("background-color:yellow");

Of course, if the condition is false and you want no color, you'd say background-color:white or something to that effect.

Let's say you don't want to highlight the row, you want to make the font of that row MAGENTA (or pink or whatever color this is). You'd go:

((HtmlOutputText )col1.get(k)).setStyle("color:#cc00cc");

And that's pretty much it for the converter. Then...

2 - Register your converter in faces-config.xml
<converter>
<converter-id>TestConverter</converter-id>
<converter-class>com.foo.converters.TestConverter</converter-class>
</converter>


3 - And finally, you apply it to the first output text in the first column in your data table in your JSP:

<h:outputText id="textT" value="#{vartest.FLD1}" styleClass="outputText" converter="TestConverter">
15 years ago
JSF
Hello there,

I asked this same question before and nobody responded.

What you have to do is this:
1 - Create a converter. In that converter, you go:

HtmlDataTable table = (HtmlDataTable) component.getParent().getParent();
- where component is the UIComponent argument that was passed in.

Then, you go:

List col = table.getChildren();
for (int i = 0; i < col.size(); i++) {
if (col != null) {
List col1 = ((UIColumn) col.get(i)).getChildren();
for (int k = 0; k < col1.size(); k++) {
if (col1 != null) {
try {

- Here is where you put your logic. If some condition is met, then you put a highlight. If not, then the background is white, or gray or whatever the default color for your page is.

And this is how you set the color:

((HtmlOutputText) col1.get(k)).setStyle("background-color:yellow");

Of course, if the condition is false and you want no color, you'd say background-color:white or something to that effect.

Let's say you don't want to highlight the row, you want to make the font of that row MAGENTA (or pink or whatever color this is). You'd go:

((HtmlOutputText )col1.get(k)).setStyle("color:#cc00cc");

And that's pretty much it for the converter. Then...

2 - Register your converter in faces-config.xml
<converter>
<converter-id>TestConverter</converter-id>
<converter-class>com.foo.converters.TestConverter</converter-class>
</converter>


3 - And finally, you apply it to the first output text in the first column in your data table in your JSP:

<h:outputText id="textT" value="#{vartest.FLD1}" styleClass="outputText" converter="TestConverter">
15 years ago
JSF
Found the answer in the forum:

"As the name 'selectOneRadio' suggests, you need to select one radio button. If not, you will see validation error." - Member # 30569
15 years ago
JSF
Hello all,

I have radio buttons on a form, within a data table. Sometimes I get: "Validation Error: Value is not valid". Since the values for this component is pretty static, I cannot figure out what's wrong. And, naturally, it prints the error for every row in the data table.

Help!
15 years ago
JSF
When displaying a data table with input fields, radio buttons, etc, do I necessarily *have* to have a backing bean? I am using Eclipse, with SDO's.
15 years ago
JSF
Hi! This is a nice tutorial that covers the fundamentals:
http://www.coreservlets.com/JSF-Tutorial/
15 years ago
JSF
This is a pretty good tutorial by Marty Hall:

http://www.coreservlets.com/JSF-Tutorial/
15 years ago
JSF