WOTextField Validation Messages
WOTextField Validation Messages
- Subject: WOTextField Validation Messages
- From: Robert Walker <email@hidden>
- Date: Tue, 15 Mar 2005 12:50:13 -0500
Hi group,
I have text fields with formatters attached in my WOComponent and I am using validationFailedWithException to display the validation error messages next to the corresponding text field. I want to override the default messages and provide more user friendly messages.
To accommodate this I am using property level validation within the EOs [validate
Key()]. This takes care of most data entry errors, but when an attached formatter fails, a validation exception is thrown before validate
Key() gets called.
I get something like:
The character x in the string xyz is not a valid character for a number with a pattern of #,##0.00;#,##0.00;-#,##0.00
I want to, somehow, catch this exception and replace the message with something like:
Invalid number format!
I have a workaround solution by searching the passed in exception's message during validationFailedWithException using something like:
if (e.getMessage().indexOf("number with a pattern of") > 0}
message = "Invalid number format!");
else if (e.getMessage().startsWith("Format.parseObject"))
message = "Invalid date format!");
else
message = e.getMessage();
It seems like there must be a better solution than this. Any suggestions are welcome.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden