There's always an easier and better way, so why not ask? (right?)
I have a field in my form for collecting someone's date-of-birth. The value
will store as an NSTimestamp in the dbase.
public void setDtDob(NSTimestamp value) {
takeStoredValueForKey(value, "dtDob");
}
Q: What is the best way to validate the users input, or get it to conform
to what NSTimestamp will accept for a valid date format?
I have the field formatted like so:
TextField5: WOTextField {
dateformat = "%m/%d/%y";
value = newDonor.dtDob;
}
...however, this does nothing to protect me from a user who insists in
typing gobbly-goop into the field. I suppose a series of dropdown elements
could help enforce input, but I'd rather use a way of catching the exception
(here is the exception when user-input cannot be parsed):
[2006-04-18 08:19:52 PDT] <WorkerThread12> Validation failed on an object
[java.lang.String] with keypath = newDonor.dtDob and exception:
Format.parseObject(String) failed
Does anyone have a good method written for testing the String in a field
against a formatting (ie. "%m/%d/%y") ?
TIA,
-Bill
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]