• 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
Re: WOTextField Validation Messages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOTextField Validation Messages


  • Subject: Re: WOTextField Validation Messages
  • From: Dana Kashubeck <email@hidden>
  • Date: Tue, 15 Mar 2005 13:53:55 -0500
  • Organization: Riemer Reporting Service Inc.

Robert Walker wrote:
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.
Could you determine what type of message to return based upon the field name (keyPath)?
--
-------------------------------------
Dana Kashubeck
Systems Manager
Riemer Reporting Service Inc.
http://www.riemer.com

Phone: 440-835-2477 x. 125
Fax:   440-835-4594
-------------------------------------

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

 _______________________________________________
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

References: 
 >WOTextField Validation Messages (From: Robert Walker <email@hidden>)

  • Prev by Date: Re: Why can't I get <addObjectToBothSidesOfRelationshipWithKey> right?
  • Next by Date: Re: WOTextField Validation Messages
  • Previous by thread: WOTextField Validation Messages
  • Next by thread: Re: WOTextField Validation Messages
  • Index(es):
    • Date
    • Thread