Question on validation
"Yury Peskin" <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello List,
I have a tiny problem with validation and I'm hoping somebody on the list
can help me.
First the code,
public class ... extends WOComponent {
public NSMutableDicitonary validationDictionary;
public Boolean hasAgreed;
<other stuff snipped>
public void awake() {
validationDictionary = new NSMutableDictionary();
}
public void sleep() {
validationDictionary = null;
}
public boolean isValidHasAgreed() {
return (validationDictionary.objectForKey("hasAgreed") != null);
}
public Object validateValueForKey(Object value, String key) throws
NSValidation.ValidationException {
<other stuff snipped>
if(key.equals("has Agreed") && ((Boolean)value).equals(new Boolean(false)))
{
validationDictionary.setObjectForKey(Boolean.TRUE, key);
throw new NSValidation.ValidationException("Can not be blank");
}
return value;
}
What I'm trying to do is change the font on the fields that are not filled
in and it works for Strings no problem, but on boolean, it's "Validation
Failed" color, even though I checked the box.
Any idea on how to get this thing to work?
Thanks,
Yury