• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
WOTextField Validation Messages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 [validateKey()]. This takes care of most data entry errors, but when an attached formatter fails, a validation exception is thrown before validateKey() 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

  • Follow-Ups:
    • Re: WOTextField Validation Messages
      • From: Arturo Perez <email@hidden>
    • Re: WOTextField Validation Messages
      • From: Dana Kashubeck <email@hidden>
  • Prev by Date: Re: Basic WO question
  • Next by Date: Re: Why can't I get <addObjectToBothSidesOfRelationshipWithKey> right?
  • Previous by thread: Re: getting the results of a sub select
  • Next by thread: Re: WOTextField Validation Messages
  • Index(es):
    • Date
    • Thread